• ORACLE12C冷备份方式的数据迁移(重建控制文件)

  • 发布时间:2016-01-13 15:20 | 作者:yc | 来源:互联网 | 浏览:1200 次
  • ORACLE12C冷备份方式的数据迁移(重建控制文件)

    试验方针:两台linux单机的oracle 12C 数据库(大年夜版别和小版别都合营),数据搬家采用冷备份的措施方针机械的道路跟源库不合营,需求重修controlfile

    搬家历程

    重要封闭监听,和kill掉落毗连的应用

    ps -ef | grep LOCAL=NO | awk '{print ($2)}' | xargs kill -9

    创立pfile

    create pfile='/tmp/inittest.ora1012' from spfile;

    反省数据文件,日志文件的道路,日志文件道路

    SQL> set line 200

    SQL> col FILE_NAME for a80

    SQL>select TABLESPACE_NAME,file_name fromdba_data_files;

    TABLESPACE_NAMEFILE_NAME

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

    SYSTEM/u01/app/oracle/oradata/test/system01.dbf

    SYSAUX/u01/app/oracle/oradata/test/sysaux01.dbf

    UNDOTBS1/u01/app/oracle/oradata/test/undotbs01.dbf

    USERS/u01/app/oracle/oradata/test/users01.dbf

    QWERTY/u01/app/oracle/oradata/test/qwerty.dbf

    TESTBIG/u01/app/oracle/oradata/test/testbig.dbf

    DATA/u01/app/oracle/oradata/test/data_01.dbf

    SQL> select TABLESPACE_NAME,file_name fromdba_temp_files;

    TABLESPACE_NAMEFILE_NAME

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

    TEMP/u01/app/oracle/oradata/test/temp01.dbf

    TEMP_ASYNC/u01/app/oracle/oradata/test/temp_async_01.dbf

    SQL> set line 200

    SQL>col MEMBER for a80

    SQL> select GROUP#,MEMBER from v$logfile;

    GROUP# MEMBER

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

    1 /u01/app/oracle/oradata/test/redo01.log

    2 /u01/app/oracle/oradata/test/redo02.log

    3 /u01/app/oracle/oradata/test/redo03.log

    SQL> show parameter control_files

    NAMETYPEVALUE

    ------------------------------------ ----------- -------------www118kj.com-----------------

    control_filesstring/u01/app/oracle/oradata/test/c

    ontrol01.ctl, /u01/app/oracle/

    fast_recovery_area/test/contro

    l02.ctl

    封闭数据库后,复制参数文件,数据文件,日志文件,操控文件

    shutdown immediate

    将统统需求的文件拷到本地,以便异常好的传输

    ORACLE12C冷备份方式的数据迁移(重建控制文件)

    cp ......

    复制文件到方针办事器上

    scp ...

    在方针办事器上修正pfile的信息

    源库

    [oracle@test dbs]$ vi inittest.ora

    test.__data_transfer_cache_size=0

    test.__db_cache_size=

    test.__java_pool_size=

    test.__large_pool_size=

    test.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

    test.__pga_aggregate_target=

    test.__sga_target=

    test.__shared_io_pool_size=

    test.__shared_pool_size=

    test.__streams_pool_size=0

    *.audit_file_dest='/u01/app/oracle/admin/test/adump'

    *.audit_trail='db'

    *.compatible='12.1.0.2.0'

    *.control_files='/u01/app/oracle/oradata/test/control01.ctl'

    *.db_block_size=8192

    *.db_domain=''

    *.db_name='test'

    *.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'

    *.db_recovery_file_dest_size=4815m

    *.diagnostic_dest='/u01/app/oracle'

    *.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'

    *.log_archive_format='%t_%s_%r.dbf'

    *.memory_target=800m

    *.open_cursors=300

    *.processes=300

    *.remote_login_passwordfile='EXCLUSIVE'

    *.undo_tablespace='UNDOTBS1'

    以下操作在方针库上实行:

    修正了操控文件的道路

    *.control_files='/u01/app/oracle/oradata/test/controlfile/control01.ctl'

    重修操控文件

    startup mount

    alter database backup controlfile to trace as '/tmp/crontol_trace';

    cat /tmp/crontol_trace | grep -v ^- | grep -v ^$ > /tmp/ctl.sql

    修正操控文件里的道路,因为咱们有onlinelog以是遴选noresetlog形式

    vi /tmp/ctl.sql

    STARTUP NOMOUNT

    CREATE CONTROLFILE REUSE DATABASE "TEST" NORESETLOGSARCHIVELOG

    MAXLOGFILES 16

    MAXLOGMEMBEwww.bodog99.comRS 3

    MAXDATAFILES 100

    MAXINSTANCES 8

    MAXLOGHISTORY 292

    LOGFILE

    GROUP 1 '/u01/app/oracle/oradata/test/onlinelog/redo01.log'SIZE 50M BLOCKSIZE 512,

    GROUP 2 '/u01/app/oracle/oradata/test/onlinelog/redo02.log'SIZE 50M BLOCKSIZE 512,

    GROUP 3 '/u01/app/oracle/oradata/test/onlinelog/redo03.log'SIZE 50M BLOCKSIZE 512

    DATAFILE

    '/u01/app/oracle/oradata/test/datafile/system01.dbf',

    '/u01/app/oracle/oradata/test/datafile/sysaux01.dbf',

    '/u01/app/oracle/oradata/test/datafile/undotbs01.dbf',

    '/u01/app/oracle/oradata/test/datafile/users01.dbf',

    '/u01/app/oracle/oradata/test/datafile/qwerty.dbf',

    '/u01/app/oracle/oradata/test/datafile/testbig.dbf',

    '/u01/app/oracle/oradata/test/datafile/data_01.dbf'

    CHARACTER SET AL32UTF8

    ;

    RECOVER DATABASE

    ALTER SYSTEM ARCHIVE LOG ALL;

    ALTER DATABASE OPEN;

    ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/test/datafile/temp01.dbf' REUSE;

    ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/test/datafile/temp02.dbf' REUSE;

    ALTER TABLESPACE TEMP_ASYNC ADD TEMPFILE '/u01/app/oracle/oradata/test/datafile/temp_async_01.dbf' REUSE;

    修正停止后,将数据库启动到nomount状况

    shutdown immediate

    startup nomout;

    运转重修操控文件的sql句子

    @/tmp/ctl.sql

    SQL> select status from v$instance;

    STATUS

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

    OPEN

    至此,现已完结数据库的搬家

    这篇文章出自 “Sysdba” 博客,请必须保存此出处http://sysdba.blog.51cto.com//

  • 相关内容

友情链接: