Restoring backup files for IBM Db2
Use the script that is provided to restore sample databases on IBM® Db2®.
To set up the sample database, you must extract the GS_DB tar.gz file, customize a configuration file, and run the setup script.
Procedure
- Go to the tm1_location/webcontent/samples/datasources folder.
- Extract the GS_DB.tar.gz file and
retain the original directory structure.
If you use WinZip to extract the GS_DB.tar.gz file on a Microsoft Windows operating system, ensure that the TAR file smart CR/LF conversion option is not selected.
- On Linux® and UNIX operating systems, modify the
file permissions on the setupGSDB.sh file so
that it is executable.
For example,
chmod u+x setupGSDB.sh
- If you want to change the sample configuration file to
use settings other than the default values, edit the GOSalesConfig file.
The configuration file on Windows is GOSalesConfig.bat. The configuration file on Linux and UNIX is GOSalesConfig.sh.
The GOSalesConfig configuration file contains the default configuration options that are used when creating the GOSALES data. The default configuration settings are listed in the following table
Table 1. Default configuration settings for GOSALES data Configuration Setting
Default
Description
GOSALES_INST
GS_DB
Used to set the name or alias of the database.
GOSALES_CREATEDB
Optional: Causes an existing database with the same name to be dropped.
GOSALES_DB_TERRITORY
US
When creating a database this is the territory of the UTF-8 database that is created.
GOSALES_BP
GOSALES_TS
GOSALES_BP
GOSALES_TS
Optional: Enter the buffer pool and tablespace name, if these are to be created by the script.
GOSALES_GRANTEES
GOSALES, DB2ADMIN
Enter the list of users, groups or PUBLIC that will have CONTROL permissions for the GOSALES, GOSALESHR, GOSALESMR and GOSALESRT schemas. This string needs to follow the syntax of the GRANT command.
GOSALESDW_GRANTEES
GOSALESDW
DB2ADMIN
Enter the list of users, groups or PUBLIC that will have CONTROL permissions for the GOSALESDW schema.
GOSALES_DPF
N
Change to 'Y' if installing a database partitioned environment (DPF)
GOSALES_SCHEMA
GOSALESHR_SCHEMA
GOSALESMR_SCHEMA
GOSALESRT_SCHEMA
GOSALESDW_SCHEMA
GOSALES
GOSALESHR
GOSALESMR
GOSALESRT
GOSALESDW
Enter the names to be used for each schema.
By default, the GS_DB database name is used and permissions are granted to the DB2ADMIN (Linux, UNIX, Windows) and GOSALES users.
- To run the setupGSDB script in interactive
mode, run following command:
- On Windows computers, in an IBM Db2 command window, change to the GS_DB\win directory and run the setupGSDB.bat script.
- On UNIX computers, from a shell prompt, source the db2profile, change to the GS_DB/unix directory, and run the setupGSDB.sh script.
The script displays a summary of your choices before you commit to changes to your environment. If you approve the choices, press Enter.
- To run the setupGSDB script from the
command line, run the following command:
- On Windows computers, run the setupGSDB.bat script.
- On UNIX computers, run the setupGSDB.sh script.
You can run the setupGSDB script with the following options:
Table 2. setupGSDB options Option
Description
-createdb Creates the database. This option drops any existing database with the same name. It creates the required buffer pool and table space.
-database database name Specifies the name of the database. This value overrides the default value of GS_DB.
-userid administration_user_ID Specifies the name of the Db2 administrator user ID that is used to create the database.
-password administration_user_ID Specifies the password for the Db2 administrator user ID.
-noprompt Indicates that no prompt will display. This option runs the script in silent mode. Any missing information causes the script to fail. You will not be prompted for any confirmations.
For example, if you are an IBM Db2 administrator and want to create the default GS_DB database on the local node, use the following command:setupGSDB -createDB -noprompt
If you want to create the tables in an existing database named SAMPLE, and you want to use the administrator user ID db2admin, run the following command:
setupGSDB -database SAMPLE -userid db2admin
The script prompts you for the password when it connects to the database. The script will replace any tables that already exist in the database, unless you choose to drop the database.
- If the GS_DB sample database is installed on a remote server
in your environment, you can link to it by cataloguing the remote
database on your local computer and then running the setup script
locally.
- If the sample database does not yet exist on the remote
server, create it by using CREATE DATABASE command.
The database requires a UTF-8 codeset and a default table space with a pagesize of 16 KB or larger. For example, on the remote server, create the database by running the following command:
CREATE DATABASE GS_DB USING CODESET UTF-8 TERRITORY US PAGESIZE 16k
- On your local computer, catalog the remote database
by using the following command:
db2 catalog tcpip node nodename remote ipaddr server port_number db2 catalog database GS_DB as GS_DB at node nodename
- On your local computer, run the following command:
setupGSDB -database GS_DB -userid administration_user_ID
You are prompted for a password to connect to the database.
- If the sample database does not yet exist on the remote
server, create it by using CREATE DATABASE command.