oracle用户远程建表、用户、授权、导入数据

在远程数据库uptest上建立用户test,表空间test,临时表空间testtemp,并授权

一、创建建表脚本(test.sql),内容如下

建表空间“test”

create tablespace test datafile '/oracle/u02/uptest/uptest/test.dbf'  size 5M;

建临时表空间“testtemp”

create TEMPORARY tablespace testtemp tempfile '/oracle/u02/uptest/uptest/testtemp.dbf'size 5M;

建用户“test”,密码为“oracle”,指定表空间“test”,临时表空间“testtemp”

create user test identified by oracle default tablespace test temporary tablespace testtemp;

为用户“test”授权" connect,resource,dba,create any table,select any dictionary "

grant  connect,resource,dba,create any table,select any dictionary to test;

 

二、建立shell脚本(test.sh),内容如下

#!/bin/sh

sqlplus /nolog  <

spool /home/oracle/test.log     将sqlplus屏幕输出到文件“test.log”

connect system/oracle@uptest  连接远端orale服务器“uptest”

@/home/oracle/test.sql        执行建表、建用户、授权脚本“test.sql”

host imp userid=system/oracle@uptest fromuser=xianmis touser=test  file=/home/oracle/test.dmp log=/home/oracle/imp.log     执行操作系统命令,导入表“test.dmp”

spool off                    关闭spool

EOF

 

将test.sql和test.dmp文件放入脚本中指定的目录,

为test.sh脚本加上执行权限:#chmod +755 test.sh

用oracle用户运行test.sh脚本。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值