oracle exp 二进制,Oracle备份之exp自动逻辑备份(二)
exp是oracle的邏輯備份,是將數(shù)據(jù)庫中的數(shù)據(jù)導(dǎo)出到二進制數(shù)據(jù)庫文件。
exp的三種導(dǎo)出方式
1.表方式(T方式),將指定表的數(shù)據(jù)導(dǎo)出。
2.用戶方式(U方式),將指定用戶的所有對象及數(shù)據(jù)導(dǎo)出。
3.全庫方式(Full方式),數(shù)據(jù)庫中的所有對象導(dǎo)出。
[oracle@TEST admin]$ cat /backup/exp.sh
#!/bin/sh
export currentTime=`date "+%Y-%m-%d_%H:%M:%S"`
export ORACLE_HOME="/u01/app/oracle/product/11.2.0.4"
export DIR="/backup"
#export serviceName=test
echo
echo -begin-
echo $currentTime
#touch /backup/$currentTime
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
$ORACLE_HOME/bin/exp hscmp/hscmp ?owner=\(hscmp, scott\) file=$DIR/$currentTime.dmp log=$DIR/$currentTime.log buffer=104857600
#1>/dev/null 2>&1
pwd
echo "-end-"
exp userid=用戶名/密碼 owner=\(用戶1,用戶2\) file=導(dǎo)出路徑/文件名.dmp log=導(dǎo)出路徑/文件名.log
buffer=數(shù)據(jù)緩沖區(qū)大小
[oracle@TEST backup]$ ./exp.sh
-begin-
2017-01-09_23:10:07
Export: Release 11.2.0.1.0 - Production on Mon Jan 9 23:10:07 2017
Copyright (c) 1982, 2009, Oracle and/or its affiliates. ?All rights reserved.
EXP-00056: ORACLE error 12504 encountered
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
EXP-00000: Export terminated unsuccessfully
/backup
-end-
找不到service_name,因為是本地導(dǎo)出,開啟本地監(jiān)聽后,不需要加@servicename
[oracle@TEST admin]$ cat listener.ora
# listener.ora Network Configuration File:
/u01/app/oracle/product/11.2.0.4/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4)
(SID_NAME = test)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.9.40)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
導(dǎo)出過程中報錯
EXP-00091: Exporting questionable statistics.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)可能字符集轉(zhuǎn)換
原來是導(dǎo)出的字符集與oracle的字符集不一樣
1、查看database中的NLS_CHARACTERSET的值
SQL> select * from nls_database_parameters t where t.parameter='NLS_CHARACTERSET';
PARAMETERVALUE
------------------- ?---------------------------------------------
NLS_CHARACTERSETAL32UTF8
SQL> select * from nls_database_parameters t where t.parameter='NLS_CHARACTERSET';
PARAMETERVALUE
------------------- ---------------------------------------------
NLS_CHARACTERSET AL32UTF8
2、根據(jù)第一步查出來的NLS_CHARACTERSET(即ZHS16GBK)來設(shè)定
windows環(huán)境:cmd > set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
linux環(huán)境:Shell > export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
EXP-00010: READHSCMP is not a valid username
沒有readhscmp這個用戶 后來添加上scott用戶
總結(jié)
以上是生活随笔為你收集整理的oracle exp 二进制,Oracle备份之exp自动逻辑备份(二)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php开启mysqlnd,如何启用mys
- 下一篇: oracle字段重复新增错误,Oracl