All scripts necessary to install sample schemas reside in $ORACLE_HOME/demo/schema directory. Before you install sample schemas by running these scripts, follow these guidelines:

  1. You must connect as a system administrator using the SYSDBA privilege.

  2. When prompted to enter a password for the schema, enter a secure password that meets the requirements described in Oracle Database Security Guide.

  3. When prompted for tablespace names while running scripts:

    • Enter an appropriate tablespace name, for example, users as the default tablespace for a schema

    • Enter temp as the temporary tablespace for a schema

  4. When prompted for the log directory name, enter $ORACLE_HOME/demo/schema/log/ or any other existing directory name.

Note:

Make sure that you end the log directory name with a trailing slash, for example, $ORACLE_HOME/demo/schema/log/

Installing the HR Schema

All scripts necessary to create the Human Resource (HR) schema reside in $ORACLE_HOME/demo/schema/human_resources.

You need to call only one script, hr_main.sql, to create all the objects and load the data. The following steps provide a summary of the installation process:

  1. Log on to SQL*Plus as SYS and connect using the AS SYSDBA privilege.

    sqlplus connect sys as sysdba
    Enter password: password
    
  2. To run the hr_main.sql script, use the following command:

    SQL> @?/demo/schema/human_resources/hr_main.sql
    
  3. Enter a secure password for HR

    specify password for HR as parameter 1:
    Enter value for 1:
    

    See Also:

    Oracle Database Security Guide for the minimum password requirements
  4. Enter an appropriate tablespace, for example, users as the default tablespace for HR

    specify default tablespace for HR as parameter 2:
    Enter value for 2:
    
  5. Enter temp as the temporary tablespace for HR

    specify temporary tablespace for HR as parameter 3:
    Enter value for 3:
    
  6. Enter your SYS password

    specify password for SYS as parameter 4:
    Enter value for 4:
    
  7. Enter the directory path, for example, $ORACLE_HOME/demo/schema/log/, for your log directory

    specify log path as parameter 5:
    Enter value for 5:
    

After the hr_main.sql script runs successfully and the HR schema is installed, you are connected as the user HR. To verify that the schema was created, use the following command:

SQL> SELECT       table_name FROM user_tables;

Running hr_main.sql accomplishes the following tasks:

  1. Removes any previously installed HR schema

  2. Creates the user HR and grants the necessary privileges

  3. Connects as HR

  4. Calls the scripts that create and populate the schema objects

posted on 2014-01-09 16:15  七月逆流  阅读(393)  评论(0编辑  收藏  举报