Installing Sample Schemas ( HR Schema )

quoted from:

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/comsc/installing-sample-schemas.html#GUID-1E645D09-F91F-4BA6-A286-57C5EC66321D


Starting with Oracle Database 12c Release 2, the latest version of the sample schema scripts are available on GitHub at https://github.com/oracle/db-sample-schemas/releases/latest.

During a complete installation of Oracle Database, the HR schema can be installed either manually or automatically when creating a database using the dbca option. All the other sample schemas must be installed manually via the scripts available on GitHub.

This chapter contains the following topics:

2.1 Installing HR Schema Only

 

This section contains the following topics:

2.1.1 Installing HR Schema Using Database Configuration Assistant

Select the sample schemas option to install HR schema in the database.

At the end of the installation process, a dialog box displays the accounts that have been created and their lock status. By default, sample schemas are locked and their passwords are expired. Before you can use a locked account, you must unlock it and reset its password. You can unlock the accounts at this point in the installation process. Alternatively, after the installation completes, you can unlock the schemas and reset their passwords by using the ALTER USER ... ACCOUNT UNLOCK statement. For example:

ALTER USER hr ACCOUNT UNLOCK IDENTIFIED BY Password;

See Also:

"Guidelines for Securing Passwords" in Oracle Database Security Guide for guidelines related to creating secure passwords

2.1.2 Manually 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:
    

    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:
    
  4. Enter temp as the temporary tablespace for HR

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

    specify password for SYS as parameter 4:
    Enter value for 4:
    
  6. 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 script hr_main.sql runs successfully and schema HR is installed, you are connected as 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 user HR and grants the necessary privileges
  3. Connects as HR
  4. Calls the scripts that create and populate the schema objects

For a complete listing of the scripts and their functions, refer to HR Sample Schema Scripts and Objects.

A pair of optional scripts, hr_dn_c.sql and hr_dn_d.sql, is provided as a schema extension. To prepare schema HR for use with the directory capabilities of Oracle Internet Directory, run the hr_dn_c.sql script. If you want to return to the initial setup of schema HR, use script hr_dn_d.sql to undo the effects of script hr_dn_c.sql.

You can use script hr_drop.sql to drop schema HR.

See Also:

Oracle Database Security Guide for the minimum password requirements

2.1.3 Uninstalling HR Schema

If you need to remove the HR schema, run the following script on the SQL* Plus command line.

sqlplus system/systempw@connect_string
@drop_hr.sql
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值