出处:http://blog.csdn.net/yh_zeng2 http://blog.csdn.net/yh_zeng2/article/details/76544794
1)创建表空间
[sql] view plain copy print ? CREATE TABLESPACE test LOGGING DATAFILE ’E:\oradata\test.DBF’ SIZE 32M AUTOEXTEND ON NEXT 1M EXTENT MANAGEMENT LOCAL; CREATE TABLESPACE test LOGGING DATAFILE 'E:\oradata\test.DBF' SIZE 32M AUTOEXTEND ON NEXT 1M EXTENT MANAGEMENT LOCAL;2)创建用户并指定表空间
[sql] view plain copy print ? CREATE USER test IDENTIFIED BY test DEFAULT TABLESPACE test TEMPORARY TABLESPACE TEMP; CREATE USER test IDENTIFIED BY test DEFAULT TABLESPACE test TEMPORARY TABLESPACE TEMP;3)给用户授权DBA权限
[sql] view plain copy print ? GRANT connect,dba TO test; GRANT connect,dba TO test;4)给用户授权,可以创建DBLINK
[sql] view plain copy print ? GRANT create database link to test; GRANT create database link to test;1)删除用户和用户相关的数据
[sql] view plain copy print ? drop user test cascade; drop user test cascade;2)删除表空间和相应文件
[sql] view plain copy print ? drop tablespace test including contents and datafiles; drop tablespace test including contents and datafiles;1)imp导入
[plain] view plain copy print ? imp test/test@ORCL file=F:\数据库备份\broker[2015-06-26].dmp fromuser=sirm touser=yh_test log=F:\数据库备份\broker[2015-06-26]_imp.log ignore=y imp test/test@ORCL file=F:\数据库备份\broker[2015-06-26].dmp fromuser=sirm touser=yh_test log=F:\数据库备份\broker[2015-06-26]_imp.log ignore=y2)exp导出
[plain] view plain copy print ? exp test/test@RTJJ file=F:\数据库备份\2015-07-10.dmp tables=(RT_OUTGOINGREQUEST,RT_TRADESURVEYLOG,RT_TRADESURVEYLOGDOC) log=F:\数据库备份\2015-07-10.log exp test/test@RTJJ file=F:\数据库备份\2015-07-10.dmp tables=(RT_OUTGOINGREQUEST,RT_TRADESURVEYLOG,RT_TRADESURVEYLOGDOC) log=F:\数据库备份\2015-07-10.log1)创建directory
[sql] view plain copy print ? CREATE OR REPLACE DIRECTORY dmpdir AS ‘E:\公司资料\数据备份’; GRANT read, write ON DIRECTORY dmpdir TO test; CREATE OR REPLACE DIRECTORY dmpdir AS 'E:\公司资料\数据备份'; GRANT read, write ON DIRECTORY dmpdir TO test;2)远程导出/导入
使新创建的用户test登录并创建数据库连接DBLINK: [sql] view plain copy print ? sqlplus test/test as sysdba; create public database link dlink_test connect to test identified by test using ‘test’; – using ‘test’中,test是远程服务名,是在Net Manager配置的服务命名,也可以使用127.0.0.1/orcl sqlplus test/test as sysdba; create public database link dlink_test connect to test identified by test using 'test'; -- using 'test'中,test是远程服务名,是在Net Manager配置的服务命名,也可以使用127.0.0.1/orcl 远程导出: [plain] view plain copy print ? EXPDP test/test DIRECTORY=dmpdir NETWORK_LINK=dlink_test DUMPFILE=test.dmp SCHEMAS=test LOGFILE=test_expdp.log version=10.2.0.4.0 EXPDP test/test DIRECTORY=dmpdir NETWORK_LINK=dlink_test DUMPFILE=test.dmp SCHEMAS=test LOGFILE=test_expdp.log version=10.2.0.4.0 远程导入: [plain] view plain copy print ? impdp test/test DIRECTORY=dmpdir NETWORK_LINK=dlink_test SCHEMAS=test remap_schema=test2:test remap_tablespace=test2:test table_exists_action=REPLACE LOGFILE=test_import.log impdp test/test DIRECTORY=dmpdir NETWORK_LINK=dlink_test SCHEMAS=test remap_schema=test2:test remap_tablespace=test2:test table_exists_action=REPLACE LOGFILE=test_import.log3)本地导出/导入
本地导出: [plain] view plain copy print ? EXPDP test/test@orcl DIRECTORY=dmpdir DUMPFILE=test.dmp SCHEMAS=test LOGFILE=test_expdp.log version=10.2.0.4.0 EXPDP test/test@orcl DIRECTORY=dmpdir DUMPFILE=test.dmp SCHEMAS=test LOGFILE=test_expdp.log version=10.2.0.4.0 本地导入: [plain] view plain copy print ? impdp test/test@orcl DIRECTORY=dmpdir DUMPFILE=test2.dmp SCHEMAS=test remap_schema=test2:test remap_tablespace=test2:test table_exists_action=REPLACE LOGFILE=test2_import.log impdp test/test@orcl DIRECTORY=dmpdir DUMPFILE=test2.dmp SCHEMAS=test remap_schema=test2:test remap_tablespace=test2:test table_exists_action=REPLACE LOGFILE=test2_import.log