Restore the samples on Oracle using a script

You can use scripts to restore backup files for sample databases for Oracle.

To set up the sample database, you must extract the file GS_DB_ORA.tar.gz, customize a configuration file, and run the setup script.

There are prerequisites for installing the Great Outdoors sample database for Oracle. Before you can install the sample databases, you must verify or configure privileges.

Optional: Editing the configuration file

The configuration file contains the default configuration options that are used when creating the GOSALES data.

Table 1. Optional values for restoring the samples on Oracle

Configuration Setting

Default

Description

GOSALES_IMP_CMD

imp

If necessary can be modified to specify the complete path to the correct version of the import utility.

GOSALES_INST

 

Oracle host string.

GOSALES_TS

GOSALES_TS

If users are created by scripts, used to enter the tablespace name to assign to users.

GOSALES_CREATE_TS

 

Optional: Used to create the default tablespace for users.

GOSALES_TEMP_TS

 

If users are created by scripts, used to name a temporary tablespace to assign to users. Leave blank to use the default temporary tablespace.

GOSALES_SCHEMA

GOSALES_SCHEMA_PW

GOSALES

GOSALESPW

Used to enter the username and password for the GOSALES user. You will be prompted for a password if not entered.

GOSALESHR_SCHEMA

GOSALESHR_SCHEMA_PW

GOSALESHR

GOSALESHRPW

Used to enter the username and password for the GOSALESHR user. You will be prompted for a password if not entered.

GOSALESMR_SCHEMA

GOSALESMR_SCHEMA_PW

GOSALESMR

GOSALESMRPW

Used to enter the username and password for the GOSALESMR user. You will be prompted for a password if not entered.

GOSALESSRT_SCHEMA

GOSALESRT_SCHEMA_PW

GOSALESRT

GOSALESRTPW

Used to enter the username and password for the GOSALESRT user. You will be prompted for a password if not entered.

GOSALESDW_SCHEMA

GOSALESDW_SCHEMA_PW

GOSALESDW

GOSALESDWPW

Used to enter the username and password for the GOSALESDW user. You will be prompted for a password if not entered.

GOSALES_GRANTEES

GOSALES

Used to enter the users that will have SELECT, INSERT, DELETE, UPDATE, and ALTER permissions for GOSALES, GOSALESHR, GOSALESMR and GOSALESRT schemas.

Note: The owner of the GOSALES_SCHEMA will always be granted SELECT, INSERT, DELETE, UPDATE and ALTER privilege on all schemas.

GOSALESDW_GRANTEES

GOSALESDW

Used to enter the users that will have SELECT, INSERT, DELETE, UPDATE and ALTER permissions for GOSALESDW schema.

You can customize the sample configuration file to use settings other than the default values.

The setup script creates the users and schemas specified in the configuration file. In most situations, you can accept the default options. If you want to change the schema names or modify the users or groups that have permissions on the data, you must update the GOSalesConfig configuration file.

Edit the GOSalesConfig.bat or GOSalesConfig.sh configuration file by using a text editor.

Running the setup script in interactive mode

In interactive mode, the setupGSDB script prompts you to confirm or provide configuration information for the sample database installation. You can accept the default settings or provide different settings to replace the defaults.

  • Run the setup script for your operating system.
Table 2. Running the samples restore script

Operating System

Command

Microsoft Windows

In a DOS command window, change to the GS_DB_ORA\win directory and run the setupGSDB.bat script.

UNIX

From a shell prompt, change to the GS_DB_ORA/unix directory, and run the setupGSDB.sh script.

  • Press Enter to proceed. The script will run the sample database setup and display a summary of your choices before you commit to changes to your environment. If you approve the choices, press Enter and the script makes the changes. For example, you might see the following message:

    Please confirm the following settings:
     
    Instance Name is ORAINST123
    Create the following user accounts and import the data:
    	GOSALES
    	GOSALESHR
    	GOSALESMR
    	GOSLAESRT
    	GOSALESDW
     
    Default tablespace is GOSALES_TS
    Temporary tablespace is DEFAULT
    Administration User name is sys
     
    WARNING: If the users already exist they will be dropped
     
    Create a Tablespace named GOSALES_TS
     
    Grant select on the GOSALES schemas to GOSALES
    Grant select on the GOSALESDW schema to GOSALESDW
     
    Continue creating the sample data with these settings?
    (Y/N) Default=Y:
Tip: If you edit UNIX shell scripts in a Windows environment, ensure that you preserve the UNIX line endings.

Running the setup script with command line options

The setupGSDB script lets you provide information on the command line to reduce the number of prompts from the script.

From a command line, run the script for your operating system. On Windows use setupGSDB.bat. On UNIX or Linux operating systems use setupGSDB.sh.

You can run the setupGSDB script with the following options:

Table 3. setupGSDB options for Oracle

Option

Description

-createdb

Creates the users. This option drops any existing users with the same name.

-database database name

Specifies the name of the Oracle instance. This value overrides the default value specified in the configuration file.

-userid administration_user_ID

Specifies the name of the Oracle administrator user ID that is used to create the users.

-password administration_user_ID

Specifies the password for the Oracle 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.

Example 1: You are an Oracle administrator and want to create the default sample database schemas. You run the following command:

setupGSDB -createDB -noprompt

Example 2: You want to create the tables in the existing schemas specified in the configuration file, and you want to use the administrator user ID sys. Run the following command:

setupGSDB -YourOracleInstance -userid sys -sysdba

The script prompts you for the password when it connects to the Oracle instance. The script deletes any existing tables or views in the specified schemas and replaces them.