LINUX下环境下链接oracle 数据库搭建测试环境

--1、建表空间  

CREATE TABLESPACE product  

DATAFILE '/datafs/orcl/orcl/product03.dbf' size 32000M AUTOEXTEND OFF;

 

ALTER TABLESPACE product  ADD

DATAFILE '/datafs/orcl/orcl/product04.dbf' size 32000M AUTOEXTEND OFF;

--2.建用户  

create user product identified by product   

default tablespace product;  

 

--3.赋权  

grant connect,resource to product;  

grant create any sequence to product;  

grant create any table to product;  

grant delete any table to product;  

grant insert any table to product;  

grant select any table to product;  

grant unlimited tablespace to product;  

grant execute any procedure to product;  

grant update any table to product;  

grant create any view to product;  

 

查看数据库源名称:

SQL> select name from v$database;

NAME
---------
ORCL

 

 

 

4、查看表空间

SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size FROM dba_tablespaces 

t, dba_data_files d WHERE t.tablespace_name = d.tablespace_name GROUP BY t.tablespace_name; 

5、执行工具导出数据

sh exp.sh

 

exp.sh 内容:

#!/bash
/datafs/f/unload user/password I_LICY

6、--从进入的服务器中某目录下拷贝文件到另外一个服务器目录下,test是用户名

scp /datafs/fgg/*.unl test@10.31.57.76:/home/test/xiaobo/SQL

7、执行DDL文件生成库表

sh t_ddl.sh;

 

t_ddl.sh 文件内容:

echo "**************************** BEGIN PRODUCT ****************************"
#认证部分
if [ "$1" = "" ]
then
 echo "请输入PRODUCT密码:";
 read PASSWD;
else  
 PASSWD=$1;
fi


#设置部分
sqlplus -s PRODUCT/$PASSWD<<EOF
set errorlogging on;
alter session set nls_language=american;
set heading off;
set echo off;
set verify off;
set pagesize 0;

 

spool PRODUCT_DDL.SQL.LOG

 

@./SQL/PRODUCT_DDL.SQL


spool off
quit;
EOF
echo "**************************** END   PRODUCT ****************************"

 

8、执行工具导入数据

sh t_dml.sh;

 

t_dml.sh 文件内容:

#!/bash


/home/test/xiao/load -U user/password -F ./SQL/Y.unl -T Y
/home/test/xiao/load -U user/password -F ./SQL/CY_DUR.unl -T CY_DUR

9、select * from all_all_tables where  owner='USER' and num_rows='0'

查看数据为0的数据库表

转载于:https://my.oschina.net/u/2822116/blog/692939

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值