记一次Oracle实例迁移

前端之家收集整理的这篇文章主要介绍了记一次Oracle实例迁移前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

背景

环境:

oracle为11.2版本 Linux-Centos6.5操作系统。

现状:

两台主机198,197 ,均已安装了oracle服务端。

其中198上已经创建了两个实例,197上只有orcl实例。

需要在197上搭建一套环境,数据保持和198一致。

步骤概述

  1. 停198数据库

  2. 将/oracle/product/112/dbs目录下的全部文件copy到197对应目录

  3. /oracle/admin目录以及子目录迁到197对应目录 ,文件可以不迁。

  4. /oradata/instance1 /oradata/instance2 全部文件数据迁到197对目录

  5. 数据库监听同步修改

操作步骤

停止198库

使用 oracle用户操作 su - oracle

Last login: Tue Sep 20 04:59:33 2016 from 10.45.22.168
oracle@entel2:[/oracle]$sqlplus sys/****** as sysdba

sql*Plus: Release 11.2.0.4.0 Production on Tue Sep 20 05:43:15 2016

Copyright (c) 1982,2013,Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning,OLAP,Data Mining and Real Application Testing options

sql> shutdown immediate
^CORA-01013: user requested cancel of current operation

shutdown immediate无反应......取消,改用abort

sql> shutdown abort;
ORACLE instance shut down.
sql>

copy数据到197对应目录

scp -r /oracle/product/112/dbs oracle@10.45.7.197:/oracle/product/112/

scp -r  /oradata/instance1/ oracle@10.45.7.197:/oradata/

scp -r  /oradata/instance2/ oracle@10.45.7.197:/oradata/

操作之前请先确保197主机对应目录存在,确保存储空间足够.

启动197主机上的实例

oracle@entel1:[/oracle]$sqlplus sys/system as sysdba

sql*Plus: Release 11.2.0.4.0 Production on Tue Sep 20 11:52:02 2016

Copyright (c) 1982,Oracle.  All rights reserved.

Connected to an idle instance.

sql> shutdown immediate
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
sql> 
sql> startup force
ORACLE instance started.

Total System Global Area 6530822144 bytes
Fixed Size          2265384 bytes
Variable Size        1140854488 bytes
Database Buffers     5368709120 bytes
Redo Buffers           18993152 bytes
Database mounted.
ORA-01172: recovery of thread 1 stuck at block 85000 of file 5
ORA-01151: use media recovery to recover block,restore backup if needed


sql> show parameter audit_file_dest

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest              string  /oracle/admin/instance1/adump
sql> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
sql> startup
ORACLE instance started.

Total System Global Area 6530822144 bytes
Fixed Size          2265384 bytes
Variable Size        1140854488 bytes
Database Buffers     5368709120 bytes
Redo Buffers           18993152 bytes
Database mounted.
ORA-01172: recovery of thread 1 stuck at block 85000 of file 5
ORA-01151: use media recovery to recover block,restore backup if needed

解决sql> select file#,name from v$datafile where file#=5;

     FILE#
----------
NAME
--------------------------------------------------------------------------------
     5
/oradata/instance1/tab_instance1_01.dbf


sql>  recover datafile 5;
Media recovery complete.


从损坏的磁盘中恢复可读取的信息。

--------------------------------------------------------------------------------

sql> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
sql> startup
ORACLE instance started.

Total System Global Area 6530822144 bytes
Fixed Size          2265384 bytes
Variable Size        1140854488 bytes
Database Buffers     5368709120 bytes
Redo Buffers           18993152 bytes
Database mounted.
ORA-00600: internal error code,arguments: [kcratr_scan_lastbwr],[],[]


看日志: /oracle/diag/rdbms/instance1/instance1/trace/alert_instance1.log
Reread (file 3,block 2136) found same corrupt data (logically corrupt)
******** WRITE VERIFICATION Failed ********
出现了逻辑坏块 (logically corrupt),因此需要进行介质恢复。

sql> shutdown immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
sql> startup mount ;
ORACLE instance started.

Total System Global Area 6530822144 bytes
Fixed Size          2265384 bytes
Variable Size        1140854488 bytes
Database Buffers     5368709120 bytes
Redo Buffers           18993152 bytes
Database mounted.
sql> recover database ;
Media recovery complete.
sql> alter database open ;

Database altered.

自此OK,数据库可以正常访问了.

原文链接:https://www.f2er.com/oracle/212526.html

猜你在找的Oracle相关文章