ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 转: Super fast Database Copying

转: Super fast Database Copying

原创 Linux操作系统 作者:jacky2000 时间:2004-03-26 13:36:04 0 删除 编辑
Super fast Database Copying

February, 24, 2004
Don Burleson



This procedure can be use to quickly migrate a system from one UNIX server to another.

STEP 1: On the old system, go into SQL*Plus, sign on as SYSDBA and issue: “alter system backup controlfile to trace”. This will put the create database syntax in the trace file directory. The trace keyword tells oracle to generate a script containing a create controlfile command and store it in the trace directory identified in the user_dump_dest parameter of the init.ora file. It will look something like this:

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGS
NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 240
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILE
GROUP 1 ('/u03/oradata/oldlsq/log1a.dbf',
'/u03/oradata/olslsq/log1b.dbf') SIZE 30M,
GROUP 2 ('/u04/oradata/oldlsq/log2a.dbf',
'/u04/oradata/oldlsq/log2b.dbf') SIZE 30M
DATAFILE
'/u01/oradata/oldlsq/system01.dbf',
'/u01/oradata/oldlsq/mydatabase.dbf'
;
# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;


STEP 2: Shutdown the old database

STEP 3: Copy all data files into the new directories on the new server. You may change the file names if you want, but you must edit the controlfile to reflect the new data files names on the new server.

rcp /u01/oradata/oldlsq/* newhost:/u01/oradata/newlsq
rcp /u01/oradata/oldlsq/* newhost:/u01/oradata/newlsq
rcp /u03/oradata/oldlsq/* newhost:/u03/oradata/newlsq
rcp /u04/oradata/oldlsq/* newhost:/u04/oradata/newlsq


STEP 4: Copy and Edit the Control file – Using the output syntax from STEP 1, modify the controlfile creation script by changing the following:

Old:

CREATE CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGS

New:

CREATE CONTROLFILE SET DATABASE "NEWLSQ" NORESETLOGS

STEP 5: Remove the “recover database” and “alter database open” syntax

# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;


STEP 6: Re-names of the data files names that have changed.

Save as db_create_controlfile.sql.

Old:

DATAFILE
'/u01/oradata/oldlsq/system01.dbf',
'/u01/oradata/oldlsq/mydatabase.dbf'

New:

DATAFILE
'/u01/oradata/newlsq/system01.dbf',
'/u01/oradata/newlsq/mydatabase.dbf'

STEP 7: Create the bdump, udump and cdump directories

cd $DBA/admin
mkdir newlsq
cd newlsq
mkdir bdump
mkdir udump
mkdir cdump
mkdir pfile


STEP 8: Copy-over the old init.ora file

rcp $DBA/admin/olslsq/pfile/*.ora newhost:/u01/oracle/admin/newlsq/pfile


STEP 9: Start the new database

startup nomount;
@db_create_controlfile.sql


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

Need a personal Oracle Mentor?

I'm now offering personal mentors for Oracle DBAs where you can have an Oracle expert right at your fingertips, anytime day or night.

We work with hundreds of Oracle databases every year, so we know exactly how to quickly assist you with any Oracle question.  

You can get me personally or any of my Oracle Certified with more than than 20 years of full-time IT experience.



Regards,


Don Burleson
2729 Rocky Ford Rd.
Kittrell, NC, USA, 27544

www.remote-dba.net  
   

Burleson Consulting
One Burleson Plaza - First Floor - RN3
2729 Rocky Ford Road • Kittrell, NC, 27544

Email: info@remote-dba.net • Phone (252) 431-0049

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/18234/viewspace-629151/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 有些迷惑 ?????????
请登录后发表评论 登录
全部评论

注册时间:2008-01-31

  • 博文量
    30
  • 访问量
    177539