12C降级到11G

今天搞了一个有意思的事情,就是把升级到12的数据库退回到11。
升级之前做了restorepoint.
升级之后的恢复:
注意我们的升级是out of place的就是有两个oracle home
一个是11的一个是12的。
如果 现在设置成11的。因为已经升级上去了。
所以rman是进不去的。
那我设置成12的oracle home开始闪回。


RMAN> STARTUP MOUNT


Oracle instance started
database mounted


Total System Global Area  224412041216 bytes


Fixed Size                     7659016 bytes
Variable Size              40218628600 bytes
Database Buffers          184146722816 bytes
Redo Buffers                  39030784 bytes


RMAN> FLASHBACK DATABASE TO RESTORE POINT "BEFORE_DBUPG";


Starting flashback at 01-MAR-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10857 instance=pajuf1 device type=DISK




starting media recovery
media recovery complete, elapsed time: 00:01:45


Finished flashback at 01-MAR-17


RMAN> ALTER DATABASE OPEN RESETLOGS; 发现打不开发了??




RMAN> alter database open resetlogs;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 03/01/2017 07:35:26
ORA-01139: RESETLOGS option only valid after an incomplete database recovery


这里的原因是:rman不是一个升级工具,所以不能自动选择目录。所以我们要手工设置一下oracle 的binary.
就是设置:ORACLE_HOME 到 11g
这时再打开库就可以了。




SYS@pajuf1>SYS@pajuf1>SYS@pajuf1>SYS@pajuf1>  2    3    4  
NAME                                       SCN TIME                                     DATABASE_INCARNATION# GUA    SIZE_GB
----------------------------------- ---------- ---------------------------------------- --------------------- --- ----------
BEFORE_ZDT                          6710886488 04-AUG-16 09.06.43.000000000 PM                             31 YES        206
pajuf_AJU_201612270132              6748808885 27-DEC-16 07.32.47.000000000 AM                             58 YES         12
pajuf_AJU_201701042329              6774293671 05-JAN-17 05.29.31.000000000 AM                             58 YES        302
pajuf_AJU_201701180052              7015598642 18-JAN-17 06.52.55.000000000 AM                             58 YES        353
BEFORE_DBUPG                        7194413795 07-FEB-17 08.09.42.000000000 AM                             58 YES         28
PREUPG_000015A81B7B2FD_$$           7221496616 27-FEB-17 11.02.47.000000000 PM                             64 YES         14


6 rows selected.
检查一下,闪回成功,已经是11了。


SYS@pajuf1>select * from (SELECT to_char(ACTION_TIME,'DD/MON/RR'), patch_id, 
patch_uid,action, status,description, BUNDLE_ID FROM dba_registry_sqlpatch 
Where BUNDLE_SERIES='DBBP' order by ACTION_TIME desc) where rownum=1  2    3  
  4  ;


no rows selected


SYS@pajuf1>select version,ID,comments,Action from (select * from dba_registry_history where namespace='SERVER' order by action_time desc ) where rownum=1;


VERSION                                ID
------------------------------ ----------
COMMENTS
------------------------------------------------------------------------------------------------------------------------------------
ACTION
------------------------------
11.2.0.4                           160811
DATABASE PATCH FOR FA-DBBP 11.2.0.4.160811 : (24479697)
APPLY


现在再看一下crs里的信息:
发现还是原来12的信息。因为crs好容易才升级好的,不想回退crs到11,我们也可以只修改一下里面的信息。
不过这个修改也和11下面的修改稍有不同:
查看信息:




 /u01/app/oracle/product/12.1.0.2/dbhome_2sec_161223/bin/srvctl config database -db pajuf 
Database unique name: pajuf
Database name: 
Oracle home: /u01/app/oracle/product/12.1.0.2/dbhome_2sec_161223
Oracle user: oracle
Spfile: +DATA/pajuf/spfilepajuf.ora
Password file: 
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: 
Disk Groups: DATA
Mount point paths: 
Services: oggservpajuf
Type: RAC
Start concurrency: 
Stop concurrency: 
OSDBA group: dba
OSOPER group: 
Database instances: pajuf1,pajuf2
Configured nodes: slcs07adm01,slcs07adm02


修改信息:
[oracle@slcs07adm01 bin]$ ./srvctl modify database -d pajuf -oraclehome "/u01/app/oracle/product/11.2.0.4/dbhome_2sec_patch0811"
PRCT-1011 : Failed to run "srvctl". Detailed error: Usage: srvctl [],    commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config|convert|upgrade,    objects: database|instance|service|nodeapps|vip|network|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns|cvu,For detailed help on each command and object and its options use:,  srvctl -h or,  srvctl -h,PRKO-2010 : Invalid command specified on command line: -V
居然说没有这个命令:
经查原来是用下面这个命令来修改不同版本里的信息:
[oracle@slcs07adm01 bin]$ ./srvctl downgrade database -d pajuf -oraclehome "/u01/app/oracle/product/11.2.0.4/dbhome_2sec_patch0811" -t 11.2.0.4.0
[oracle@slcs07adm01 bin]$ ./srvctl config database -d pajuf
PRCD-1229 : An attempt to access configuration of database pajuf was rejected because its version 11.2.0.4.0 differs from the program version 12.1.0.2.0. Instead run the program from /u01/app/oracle/product/11.2.0.4/dbhome_2sec_patch0811.
查看一下,这样就全改好了。
[oracle@slcs07adm01 bin]$ srvctl config database -d pajuf
Database unique name: pajuf
Database name: 
Oracle home: /u01/app/oracle/product/11.2.0.4/dbhome_2sec_patch0811
Oracle user: oracle
Spfile: +DATA/pajuf/spfilepajuf.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: pajuf
Database instances: pajuf1,pajuf2
Disk Groups: DATA
Mount point paths: 
Services: oggservpajuf
Type: RAC
Database is administrator managed

你可能感兴趣的:(ORACLE11G,数据库)