条件:在同版本操作系统上,复制数据库采用拷贝软件及数据库文件方式进行复制具体过程如下:
1.在源库所在Oracle安装目录下打包文件:
js_znjh_1./app/oracle$tar cvf oracle.tar admin product utils
2、FTP传输打好的包
js_znjh_2./app/oracle$ftp 134.96.14.39
Connected to 134.96.14.39.
220 js_znjh_1 FTP server (Version 4.2 Sat Sep 8 09:49:58 CDT 2007) ready.
Name (134.96.14.39:oracle): oracle
331 Password required for oracle.
Password:
230-Last unsuccessful login: Tue Dec 29 14:36:56 BEIST 2009 on ftp from ::ffff:134.98.103.55
230-Last login: Thu Jan 7 15:06:50 BEIST 2010 on /dev/pts/2 from 134.98.83.38
230 User oracle logged in.
ftp> cd /app/oracle
250 CWD command successful.
ftp> bin
200 Type set to I.
ftp> dir
200 PORT command successful.
150 Opening data connection for /bin/ls.
total 1408
drwxrwxr-x 16 oracle dba 4096 Jan 12 2009 7592346
drwxr-x--- 3 oracle dba 256 Oct 15 11:00 admin
drwxr-xr-x 2 root system 256 Oct 12 14:21 lost+found
drwxr-x--- 5 oracle dba 256 Oct 15 15:06 oraInventory
drwxrwx--- 6 oracle dba 256 Oct 14 11:58 oraInventory_bak
-rw-r----- 1 oracle dba 713899 Oct 14 09:10 p7592346_10204_CPU.zip
drwxrwxr-x 3 oracle dba 256 Oct 13 09:26 product
drwxr-xr-x 2 oracle dba 256 Oct 13 09:09 utils
drwxr-xr-x 2 oracle dba 256 Jan 07 10:24 oracle.tar
226 Transfer complete.
ftp> get oracle.tar
3、解压:
ftp> quit
221 Goodbye.
js_znjh_2./app/oracle$ls
lost+found oracle.tar
js_znjh_2./app/oracle$tar xvf oracle.tar
4、在源库上备份控制文件并拷贝到目标库
5、在源库上根据spfile文件生成pfile文件并拷贝到目标库
6、源库先停应用,再停库,后拷贝源库的数据库文件(停机拷贝)
7、启源库
8、目标库做更改
SQL/PLUS登录报错:
js_znjh_2./app/oracle$export ORACLE_SID=idep2
js_znjh_2./app/oracle$sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jan 7 13:21:18 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
exec(): 0509-036 Cannot load program oracleidep2 because of the following errors:
0509-130 Symbol resolution failed for /usr/lib/libc.a[aio_64.o] because:
0509-136 Symbol kaio_rdwr64 (number 1) is not exported from
dependent module /unix.
0509-136 Symbol listio64 (number 2) is not exported from
dependent module /unix.
0509-136 Symbol acancel64 (number 3) is not exported from
dependent module /unix.
0509-136 Symbol iosuspend64 (number 4) is not exported from
dependent module /unix.
0509-136 Symbol aio_nwait (number 5) is not exported from
dependent module /unix.
0509-136 Symbol aio_nwait64 (number 6) is not exported from
dependent module /unix.
0509-136 Symbol aio_nwait_timeout (number 7) is not exported from
dependent module /unix.
0509-136 Symbol aio_nwait_timeout64 (number 8) is not exported from
dependent module /unix.
0509-026 System error: Error 0
0509-192 Examine .loader section symbols with the
'dump -Tv' command.
ERROR:
ORA-12547: TNS:lost contact
网上搜索提示说:AIO有问题,或没开放,命令查看:
js_znjh_2./dev$lsattr -El aio0
autoconfig defined STATE to be configured at system restart True
fastpath enable State of fast path True
kprocprio 39 Server PRIORITY True
maxreqs 4096 Maximum number of REQUESTS True
maxservers 10 MAXIMUM number of servers per cpu True
minservers 1 MINIMUM number of servers True
发现没问题,求助SA,也说AIO没问题,那这问题出在哪?继续网上搜索,有人提到 run rootpre.sh,开始RELINK ALL 的时候只是看到日志里面有很多的告警,内容比较多
没有仔细看,但是末尾有提示说要执行root.sh文件,但是没有提醒要执行rootpre.sh文件,
试试这个文件吧,源地址上也没有了,只好去安装软件的压缩包里面重新解压取这个文件,需要ROOT权限才能运行,SA协助,解决了!!
又碰到一个问题,
建控制文件不起来,怪了第一、二个可以建起来,第三个提示路径不对,怪吧,要么一个都建不起来啊,后来发现时initSID.ora这个文件是源库拷贝内容过来的,有换行,晕!
CREATE CONTROLFILE REUSE SET DATABASE "idep2" RESETLOGS FORCE LOGGING NOARCHIVELOG
*
ERROR at line 1:
ORA-01503: CREATE CONTROLFILE failed
ORA-00200: control file could not be created
ORA-00202: control file: '/DataExchange2/oradata/id
ep2/control03.ctl'
ORA-27040: file create error, unable to create file
IBM AIX RISC System/6000 Error: 2: No such file or directory
具体语句如下:
create pfile='/app/oracle/product/10.2.0/db_1/dbs/init_idep2.ora' from spfile;
idep2.__db_cache_size=4261412864
idep2.__java_pool_size=16777216
idep2.__large_pool_size=16777216
idep2.__shared_pool_size=1023410176
idep2.__streams_pool_size=33554432
*.audit_file_dest='/app/oracle/admin/idep2/adump'
*.background_dump_dest='/app/oracle/admin/idep2/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/DataExchange2/oradata/idep2/control01.ctl','/DataExchange2/oradata/idep2/control02.ctl','/DataExchange2/oradata/idep2/control03.ctl'
*.core_dump_dest='/app/oracle/admin/idep2/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='idep2'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=1174405120
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1105
*.sga_max_size=5368709120
*.sga_target=5368709120
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/app/oracle/admin/idep2/udump'
orapwd file=/app/oracle/product/10.2.0/db_1/dbs/orapwidep2 password=idep240 entries=10;
alter database backup controlfile to trace;
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE SET DATABASE "idep2" RESETLOGS FORCE LOGGING NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/DataExchange2/oradata/idep2/redo01.log' SIZE 1024M,
GROUP 2 '/DataExchange2/oradata/idep2/redo02.log' SIZE 1024M,
GROUP 3 '/DataExchange2/oradata/idep2/redo03.log' SIZE 1024M
-- STANDBY LOGFILE
DATAFILE
'/DataExchange2/oradata/idep2/system01.dbf',
'/DataExchange2/oradata/idep2/undotbs01.dbf',
'/DataExchange2/oradata/idep2/sysaux01.dbf',
'/DataExchange2/oradata/idep2/zhjs_index01.dbf',
'/DataExchange2/oradata/idep2/zhjs_acc01.dbf',
'/DataExchange2/oradata/idep2/zhjs_param01.dbf',
'/DataExchange2/oradata/idep2/zhjs_log01.dbf',
'/DataExchange2/oradata/idep2/zhjs_log02.dbf'
CHARACTER SET ZHS16GBK;
alter database open resetlogs;
ALTER TABLESPACE TEMP ADD TEMPFILE '/DataExchange2/oradata/idep2/temp01.dbf'
SIZE 2048M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE ZHJS_TEMP ADD TEMPFILE '/DataExchange2/oradata/idep2/zhjs_temp01.dbf'
SIZE 5120M REUSE AUTOEXTEND OFF;
alter database rename global_name to idep2;