背景
环境:
oracle为11.2版本 Linux-Centos6.5操作系统。
现状:
两台主机198,197 ,均已安装了oracle服务端。
其中198上已经创建了两个实例,197上只有orcl实例。
需要在197上搭建一套环境,数据保持和198一致。
步骤概述
停198数据库
将/oracle/product/112/dbs目录下的全部文件copy到197对应目录
/oracle/admin目录以及子目录迁到197对应目录 ,文件可以不迁。
/oradata/instance1 /oradata/instance2 全部文件数据迁到197对目录
- 数据库监听同步修改
操作步骤
停止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>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
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/
- 1
- 2
- 3
- 4
- 5
操作之前请先确保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, 2013, 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.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
自此OK,数据库可以正常访问了.