手动增加Sales History, SH Schema

1.从github download 整个demo脚本,demo scripts,然后使用scp 命令复制到目的地主机

scp db-sample-schemas-master.zip oracle@172.19.2.31:/home/oracle/.

2.解压缩

unzip db-sample-schemas-master.zip

3.将原有sales_history重命名

mv $ORACLE_HOME/demo/schema/sales_history $ORACLE_HOME/demo/schema/sales_history.old

4.从刚刚解压缩出来的目录中找到sales_history目录,并复制到$ORACLE_HOME/demo/schema

cp db-sample-schemas-master/sales_history $ORACLE_HOME/demo/schema/

5.使用sed将脚本中的__SUB__CWD__/sales_history/ 替换成实际目录

sed -i "s#__SUB__CWD__/sales_history/#/oracle/app/product/10.2.0/demo/schema/sales_history/#g" `grep  __SUB__CWD__/sales_history/ -rl --include="*.sql" ./`

这一步很重要,否则会出错

SP2-0310: unable to open file "__SUB__CWD__/sales_history/psh_v3"

6.在$ORACLE_HOME/network/admin/tnsadmin.ora中添加connect string,ip与sid指向本机实例就行,这个稍后运行脚本时会使用

hr =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.19.2.31)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = PCIATEST)
    )
  )

7.打开sqlplus,运行sh_main.sql脚本

SQL> @./sh_main.sql
specify password for SH as parameter 1:
Enter value for 1:                  ---为账号sh指定密码
specify default tablespace for SH as parameter 2:
Enter value for 2:                  ---指定数据将存储的tablespace
specify temporary tablespace for SH as parameter 3:
Enter value for 3:                  ---指定使用的临时tablespace
specify password for SYS as parameter 4:
Enter value for 4:                  ---输入sys的密码
specify directory path for the data files as parameter 5:  
Enter value for 5:                  ---这里的数据文件不是指存放table数据的datafile,而是因为sh_main.sql创建table后,会使用sqlldr载入数据,被载入的数据位于刚刚copy过来的sales_history下,我的范本里,位置是$ORACLE_HOME/demo/schema/sales_history/, 注意,路径最后的正斜线(/)不要忘记输入
writeable directory path for the log files as parameter 6:
Enter value for 6:                   ---同上,sqlldr会产生log,这是log存放的位置
specify version as parameter 7:
Enter value for 7:                   ---这不是数据库的版本,这是sample schema的版本,从$ORACLE_HOME/demo/schema/sales_history下的文件名可以看出来(_v3.ctl、_v3.dat结尾),这里的版本是v3
specify connect string as parameter 8:    
Enter value for 7:                   ---这就是步骤6建立的connect string
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值