星期五, 3月 09, 2018

如何將12c OMF (Oracle Management Files) 轉換為手動管理

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PRODCDB                        MOUNTED
         4 PDBPROD                        MOUNTED
         5 PDBPROD1                       READ WRITE NO

SQL> show parameter db_create

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string      /u01/app/oracle/oradata
db_create_online_log_dest_1          string
db_create_online_log_dest_2          string
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string

1.reset db_create_file_dest
  SQL>
  alter system set db_create_file_dest='';
  create pfile='/tmp/pfile.ora' from spfile;

2.disable OMF (recreate controlfile)
rename controlfile from
 2.1 backup control file
   alter database backup controlfile to trace as '/tmp/bk.txt';
2.2
   edit pfile , set *.control_files='/u01/app/oracle/oradata/ORCL/controlfile/control01.ctl','/u01/app/oracle/fast_recovery_area/ORCL/controlfile/control02.ctl'
2.3
   cd /u01/app/oracle/oradata/ORCL/controlfile/ ;  cp o1_mf_f9l03p4r_.ctl control01.ctl
   cd /u01/app/oracle/fast_recovery_area/ORCL/controlfile/ ;  cp o1_mf_f9l03p6n_.ctl control02.ctl

2.4 recreate control file
   
  SQL> alter database backup controlfile to trace as '/tmp/bk.txt';

  Database altered.

  SQL> shutdown immediate;
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  SQL> exit
  Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
  [oracle@vm1 controlfile]$ vi /tmp/bk.txt  #篩選我所想要的create database ... NORESETLOGS 語法
  [oracle@vm1 controlfile]$ sqlplus / as sysdba

  SQL*Plus: Release 12.1.0.2.0 Production on Fri Mar 9 11:32:03 2018

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

  Connected to an idle instance.

  SQL> startup nomount pfile='/tmp/pfile.ora';
  ORACLE instance started.

  Total System Global Area 1660944384 bytes
  Fixed Size                  2925072 bytes
  Variable Size            1056968176 bytes
  Database Buffers          587202560 bytes
  Redo Buffers               13848576 bytes
  SQL> start /tmp/bk.txt

  Control file created.

3.create pluggable database pdbprod
 create pluggable database pdbprod2 from pdbprod1 file_name_convert=('/u01/app/oracle/oradata/ORCL/datafile/','/u01/app/oracle/oradata/PDBPROD3/datafile') nologging;
--如果是有 OMF的語法
 create pluggable database pdbprod3 from pdbprod1 nologging;

結論 : 在一建立好cdb的時候就要先決定是否使用OMF (Oracle Manage Files)來管理, 避免未來組態異動上的不方便.

參考link:
http://orcldesk.blogspot.tw/2014/11/oracle-12c-creating-pluggable-database.html

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...