oracle数据库-备份ORACLE为dmp类型数据

时间:2022-09-20 09:14:06

刘备,为自己后期脑子不灵光时可以找个可以翻阅的地方。

一、第一部分导出ORACLE数据

1、数据库地址及账号密码:

数据库地址:10.10.10.132
账号密码:oracle/oracle

2、使用Xshell登录:

输入地址及用户名称

3、查看当前数据库实例名称及安装地址路径

[oracle@localhost abs_dmp]$ env |grep ORACLE --查看当前数据库实例
ORACLE_SID=orcl --由ORACLE_SID=orcl‘可知,当前数据库实例为‘orcl’
ORACLE_BASE=/home/oracle/app
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1

4、使用sqlplus命令登录数据库查看字符集

[oracle@localhost abs_dmp]$ sqlplus / as sysdba --使用sqlplus命令登录数据库查看字符集
SQL*Plus: Release 11.2.0.3.0 Production on Thu Mar 31 05:45:29 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select userenv('language') from dual;    -- 查看数据中的字符集编码

USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_CHINA.ZHS16GBK

SQL> exit -- 退出SQL命令行

--------------------------------分割符号----------------------------------------------------------注意事项 start

此处要特别注意,不查看数据库字符集,可能会造成导出的乱码问题 就会报出警告 如:

EXP-00091: Exporting questionable statistics.
. . exporting table VISUAL_THEME_SET 2 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table WEB_ANALYTICS_CONFIG 0 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table WEB_ANALYTICS_TYPE 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table WEB_APP_SOURCE 330 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table WEB_APP_SOURCE_PERMISSION 402 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table WEB_PAGE 0 rows exported

--------------------------------分割符号----------------------------------------------------------注意事项 end

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@localhost abs_dmp]$ echo $NLS_LANG --查看环境变量“NLS_LANG”的值是否为“AMERICAN_AMERICA.AL32UTF8” 
[oracle@localhost abs_dmp]$ export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 --修改 环境变量“NLS_LANG”的值为“AMERICAN_AMERICA.AL32UTF8”
[oracle@localhost abs_dmp]$ echo $NLS_LANG      -- 查看修改后的环境变量是否成功
AMERICAN_AMERICA.AL32UTF8

-- 导出数据命令
[oracle@localhost abs_dmp]$exp userName/passwd@ORACLE_SID file=test.dmp log=./test.log --导出数据
               imp userName/passwd@ORACLE_SID file=test.dmp log=./test.log --导入数据

二、切换数据库实例  导出ORACLE数据库