码迷,mamicode.com
首页 > 其他好文 > 详细

记一次异机rman还原后的操作

时间:2019-12-16 09:51:27      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:set   wro   wing   sequence   app   rom   space   控制   errors   

当时从主库通过rman备份到目前测试库还原之后,由于备份是在备库备份的,所以数据库还原后状态为readonly,standby_file_management参数为auto。
首先需要通过alter database clear logfile group 日志组;让数据库在磁盘创建日志文件。
出现问题1、重做日志物理文件不存在,当时日志组4状态为current,无法在readonly模式下进行更改操作。问题2、参数文件的undo表空间与控制文件的不对应


SQL> alter database rename file ‘/redo1/redo/redo04a.log‘ to ‘/u3/redo1/redo/redo04a.log‘;
alter database rename file ‘/redo1/redo/redo04a.log‘ to ‘/u3/redo1/redo/redo04a.log‘
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01621: cannot rename member of current log if database is open
ORA-00312: online log 4 thread 1: ‘/redo1/redo/redo04a.log‘
ORA-00312: online log 4 thread 1: ‘/redo2/redo/redo04b.log‘


SQL> alter database clear logfile group 4;
alter database clear logfile group 4
*
ERROR at line 1:
ORA-00349: failure obtaining block size for ‘/redo1/redo/redo04a.log‘
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 9


SQL> alter database drop logfile group 4; -----就算成功了,不会删除磁盘上的文件,需手动删除
alter database drop logfile group 4
*
ERROR at line 1:
ORA-01623: log 4 is current log for instance orcl (thread 1) - cannot drop
ORA-00312: online log 4 thread 1: ‘/redo1/redo/redo04a.log‘
ORA-00312: online log 4 thread 1: ‘/redo2/redo/redo04b.log‘


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 4.2758E+10 bytes
Fixed Size 2262656 bytes
Variable Size 4966058368 bytes
Database Buffers 3.7447E+10 bytes
Redo Buffers 342855680 bytes
Database mounted.
SQL> alter database rename file ‘/redo1/redo/redo04a.log‘ to ‘/u3/redo1/redo/redo04a.log‘;
alter database rename file ‘/redo1/redo/redo04a.log‘ to ‘/u3/redo1/redo/redo04a.log‘
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01275: Operation RENAME is not allowed if standby file management is
automatic.


SQL> show parameter standby;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest string ?/dbs/arch
standby_file_management string AUTO
SQL> alter system standby_file_management=‘manual‘;
alter system standby_file_management=‘manual‘
*
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM


SQL> alter system set standby_file_management=‘manual‘ scope=both;

System altered.

SQL> alter database rename file ‘/redo1/redo/redo04a.log‘ to ‘/u3/redo1/redo/redo04a.log‘;

Database altered.

SQL> alter database rename file ‘/redo2/redo/redo04b.log‘ to ‘/u3/redo2/redo/redo04b.log‘;

Database altered.

SQL> alter database clear logfile group 4;     ----让数据库在磁盘创建日志文件

Database altered.

SQL> alter database open;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ ONLY

SQL> desc v$log;
Name Null? Type
----------------------------------------- -------- ----------------------------
GROUP# NUMBER
THREAD# NUMBER
SEQUENCE# NUMBER
BYTES NUMBER
BLOCKSIZE NUMBER
MEMBERS NUMBER
ARCHIVED VARCHAR2(3)
STATUS VARCHAR2(16)
FIRST_CHANGE# NUMBER
FIRST_TIME DATE
NEXT_CHANGE# NUMBER
NEXT_TIME DATE

SQL> select GROUP# ,STATUS,MEMBERS from v$log;

GROUP# STATUS MEMBERS
---------- ---------------- ----------
1 UNUSED 2
2 UNUSED 2
3 UNUSED 2
4 CURRENT 2
5 UNUSED 2
6 UNUSED 2
7 UNUSED 2
8 UNUSED 2

8 rows selected.

SQL> alter system switch logfile;
alter system switch logfile
*
ERROR at line 1:
ORA-16000: database open for read-only access


SQL> alter database recover managed standby database finish force;
alter database recover managed standby database finish force
*
ERROR at line 1:
ORA-00283: recovery session canceled due to errors
ORA-16157: media recovery not allowed following successful FINISH recovery


SQL> alter database commit to switchover to primary;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-30012: undo tablespace ‘UNDOTBS1‘ does not exist or of wrong type
Process ID: 20472
Session ID: 769 Serial number: 3


SQL> create undo tablespace undotbs2 datafile‘/u3/undotbs2.dbf‘ size 10g autoextend off;
create undo tablespace undotbs2 datafile‘/u3/undotbs2.dbf‘ size 10g autoextend off
*
ERROR at line 1:
ORA-01109: database not open


SQL> alter tablespace UNDOTBS1 offline;
alter tablespace UNDOTBS1 offline
*
ERROR at line 1:
ORA-01109: database not open

SQL> create pfile=‘/u3/pfile.ora‘ from spfile;

File created.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@FIHSER68 ~]$ vi /u3/pfile.ora -----将undo_tablespace参数删除
[oracle@FIHSER68 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 27 11:57:12 2019

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;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup nomount pfile=‘/u3/pfile.ora‘;
ORACLE instance started.

Total System Global Area 4.2758E+10 bytes
Fixed Size 2262656 bytes
Variable Size 5234493824 bytes
Database Buffers 3.7178E+10 bytes
Redo Buffers 342855680 bytes

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL> show parameter undo;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS10 ----此为控制文件中记录的undo_tablespace.
SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

SQL> create spfile from pfile=‘/u3/pfile.ora‘;

File created.

记一次异机rman还原后的操作

标签:set   wro   wing   sequence   app   rom   space   控制   errors   

原文地址:https://www.cnblogs.com/yaoyangding/p/12046915.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!