【ORACLE】relink oracle 10g 数据库

简介: 通常要迁移一个数据库,我们会使用1 冷备份,整个数据库迁移,2 rman duplicate 功能进行复制到本机或者复制到异机,前面两种都必须先在目标库上安装软件。
通常要迁移一个数据库,我们会使用
1 冷备份,整个数据库迁移,
2 rman duplicate 功能进行复制到本机或者复制到异机,
前面两种都必须先在目标库上安装软件。这里测试另外一种方法: 对于单实例数据库,复制整个oracle 10g 数据库到另一个服务器,relink 之后可以重新使用。。
查看源库数据库库文件在$ORACLE_BASE 目录下的分布:
oracle@yangDB1:/opt/oracle>ll
总计 36
drwxrwx--- 3 oracle oinstall 4096 08-06 16:22 10.2.0
drwxr-x--- 4 oracle oinstall 4096 08-17 17:10 admin
drwxrwxr-x 3 oracle oinstall 4096 08-06 15:14 extapi
drwxr-x--- 4 oracle oinstall 4096 08-17 18:32 flash_recovery_area
drwxr-x--- 4 oracle oinstall 4096 08-17 17:10 oradata
drwxrwxr-x 6 oracle oinstall 4096 08-06 16:28 oraInventory
drwxr-xr-x 2 oracle oinstall 4096 08-17 17:49 pri_arch
drwxr-xr-x 2 oracle oinstall 4096 08-11 13:27 std_arch -standby文件,不用
drwxr-xr-x 2 oracle oinstall 4096 08-17 18:31 yqldb_arch-上一个实验文件,不用
将数据库文件拷贝到目标库:记得将目标库设置和源库一样的结构,否则会报错!
oracle@yangDB1:/opt/oracle>scp -r flash_recovery_area 10.250.7.230:/opt/oracle
oracle@yangDB1:/opt/oracle>scp -r admin               10.250.7.230:/opt/oracle
oracle@yangDB1:/opt/oracle>scp -r oraInventory        10.250.7.230:/opt/oracle
oracle@yangDB1:/opt/oracle>scp -r 10.2.0              10.250.7.230:/opt/oracle
oracle@yangDB1:/opt/oracle>scp -r oradata/orcl/       10.250.7.230:/opt/oracle/oradata/
在目标库上:
oracle@yangDB2:/opt/oracle/10.2.0/orcl/rdbms/lib>ls
bbed        dmwdm.o       hormc.o       kciwcx.o   kprnts.o   ksnnni.o        libodm10.a      maxmem.o   s0exudrv.o  shou.o     ssbbded.o   sulmain.o   xsyeolap.o
bifile.bbd  dumpsga.o     hormd.o       kcsm.o     kprwts.o   ksnnt2.o        libperfsrv10.a  nmliblist  s0impdrv.o  sjsex.o    sskfeded.o  tg4pwd.o    zsmsdrv.o
config.c    env_rdbms.mk  horm.o        kfod.o     kpucb.o    ktd.o           libqsmashr.a    opimai.o   s0kudbv.o   skfedpt.o  sskfoded.o  tstshm.o
config.o    genezi.o      hormt.o       kgupc.o    kpudfo.o   kxmnsd.o        libskgxns.a     osh.o      s0kuzr.o    skfodpt.o  sskrmed.o   ttcoerr.o
cursize.o   genksms.o     hout.o        kgutc.o    kpundf.o   kxmwsd.o        libskgxpd.a     par.bbd    s0kvpf.o    skrmpt.o   sskrned.o   ttcsoi.o
dbfsize.o   hoaoci.o      hsxaora.o     kkpoban.o  ksms.o     kzlnlbac.o      libskgxpu.a     rfscom.o   s0udexp.o   skrnpt.o   sskrsed.o   wpspldrv.o
defopt.o    hoat.o        ins_rdbms.mk  kkxntp.o   ksnkcs.o   libdbtools10.a  libxdb.a        rfsd.o     s0udimp.o   skrspt.o   ssoraed.o   xaondy.o
dmndm.o     hoax.o        jox.o         kkxwtp.o   ksnkkpo.o  libdsga10.a     log.bbd         rfsin.o    sbbdpt.o    sllfls.o   sstrced.o   xaonsl.o
dmndmse.o   homts.o       joxoff.o      kopc.o     ksnktd.o   libknlopt.a     mapsga.o        rfsxc.o    shorm.o     srfsd.o    strcpt.o    xsnoolap.o
先执行relink oracle,然后make -f ins_rdbms.mk install
oracle@yangDB2:/opt/oracle/10.2.0/orcl/rdbms/lib>relink oracle
oracle@yangDB2:/opt/oracle/10.2.0/orcl/rdbms/lib>make -f ins_rdbms.mk install
验证:
SQL> startup
ORACLE instance started.

Total System Global Area 1224736768 bytes
Fixed Size                  2020384 bytes
Variable Size             318770144 bytes
Database Buffers          889192448 bytes
Redo Buffers               14753792 bytes
Database mounted.
Database opened.
SQL> conn yang/yang
Connected.
SQL> col tname for a15
SQL> col tabtype for a10
SQL> select * from tab;
TNAME           TABTYPE     CLUSTERID
--------------- ---------- ----------
YANGB           TABLE
YANGTAB         TABLE
YANGOBJ         TABLE
YANGUSER        TABLE
OBJECTS         TABLE
A               TABLE
6 rows selected.

SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------
orcl
===========遇到的问题============
第一次启动的时候遇到ORA-00205:
SQL> startup pfile='/tmp/initorcl.ora';
ORACLE instance started.

Total System Global Area 1224736768 bytes
Fixed Size                  2020384 bytes
Variable Size             318770144 bytes
Database Buffers          889192448 bytes
Redo Buffers               14753792 bytes
ORA-00205: error in identifying control file, check alert log for more info
检查告警日志文件,发现如下错误:
Errors in file /opt/oracle/admin/orcl/udump/orcl_ora_705.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/opt/oracle/oradata/orcl/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Sat Aug  6 16:29:12 2011
Errors in file /opt/oracle/admin/orcl/udump/orcl_ora_705.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/opt/oracle/oradata/orcl/redo02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
提示没有对应的文件或者目录。
查看数据文件,发现拷贝的时候是拷贝到/opt/oracle/ 目录下的而不是/opt/oracle/orcl 目录下,将数据文件移动到orcl目录下
oracle@yangDB2:/opt/oracle/oradata>ls
control01.ctl  control02.ctl  control03.ctl  example01.dbf  redo01.log  redo02.log  redo03.log  sysaux01.dbf  system01.dbf  temp01.dbf  undotbs01.dbf  users01.dbf
oracle@yangDB2:/opt/oracle/oradata>mkdir orcl
oracle@yangDB2:/opt/oracle/oradata>mv *.ctl orcl
oracle@yangDB2:/opt/oracle/oradata>mv *.dbf orcl
oracle@yangDB2:/opt/oracle/oradata>ls
orcl  redo01.log  redo02.log  redo03.log
oracle@yangDB2:/opt/oracle/oradata>mv *.log orcl
oracle@yangDB2:/opt/oracle/oradata>cd orcl
oracle@yangDB2:/opt/oracle/oradata>ll
oracle@yangDB2:/opt/oracle/oradata/orcl>ll
总计 1541672
-rw-r----- 1 oracle oinstall   7061504 08-17 21:40 control01.ctl
-rw-r----- 1 oracle oinstall   7061504 08-17 21:40 control02.ctl
-rw-r----- 1 oracle oinstall   7061504 08-17 21:40 control03.ctl
-rw-r----- 1 oracle oinstall 104865792 08-17 21:09 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 08-17 21:09 redo01.log
-rw-r----- 1 oracle oinstall  52429312 08-17 21:40 redo02.log
-rw-r----- 1 oracle oinstall  52429312 08-17 21:09 redo03.log
-rw-r----- 1 oracle oinstall 335552512 08-17 21:38 sysaux01.dbf
-rw-r----- 1 oracle oinstall 513810432 08-17 21:39 system01.dbf
-rw-r----- 1 oracle oinstall  20979712 08-17 20:59 temp01.dbf
-rw-r----- 1 oracle oinstall  41951232 08-17 21:39 undotbs01.dbf
-rw-r----- 1 oracle oinstall 381427712 08-17 21:09 users01.dbf
再次验证,ok!!
oracle@yangDB2:/opt/oracle/oradata/orcl>export ORCLE_SID=orcl
oracle@yangDB2:/opt/oracle/oradata/orcl>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 17 21:09:19 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> startup
ORACLE instance started.
Total System Global Area 1224736768 bytes
Fixed Size                  2020384 bytes
Variable Size             318770144 bytes
Database Buffers          889192448 bytes
Redo Buffers               14753792 bytes
Database mounted.
Database opened.
SQL> conn yang/yang
Connected.

目录
相关文章
|
Oracle 关系型数据库 数据库
|
存储 Oracle 关系型数据库
Oracle 10g通过创建物化视图实现不同数据库间表级别的数据同步
Oracle 10g通过创建物化视图实现不同数据库间表级别的数据同步
|
SQL Oracle 关系型数据库

推荐镜像

更多