`

Super fast Database Copying/Cloning

阅读更多
Super fast Database Copying/Cloning

Oracle Tips by Burleson Consulting


A database cloning procedure is especially useful for the DBA who wants to give his developers a full-sized TEST and DEV instance by cloning the PROD instance into the development server areas.

This Oracle clone procedure can be use to quickly migrate a system from one UNIX server to another. It clones the Oracle database and this Oracle cloning procedures is often the fastest way to copy a Oracle database.

STEP 1: On the old system, go into SQL*Plus, sign on as SYSDBA and issue: “alter database 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


STEP 10: Place the new database in archivelog mode

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

example:

 

CREATE CONTROLFILE SET DATABASE "POADEV" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 5
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 1
    MAXLOGHISTORY 454
LOGFILE
  GROUP 1 '/oradata/poadev/redo01.log'  SIZE 1M,
  GROUP 2 '/oradata/poadev/redo02.log'  SIZE 1M,
  GROUP 3 '/oradata/poadev/redo03.log'  SIZE 1M
DATAFILE
  '/oradata/poadev/system01.dbf',
  '/oradata/poadev/undotbs01.dbf',
  '/oradata/poadev/poaprd_fact_01.dbf',
  '/oradata/poadev/poaprd_fact_idx_01.dbf'
CHARACTER SET UTF8
;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/oradata/poadev/temp01.dbf'
     SIZE 41943040  REUSE AUTOEXTEND ON NEXT 1048576  MAXSIZE 1024M;

 

分享到:
评论

相关推荐

    Super File Copying 超级文件拷贝机

    一个强大的文件拷贝/坏区恢复工具,可以实现拷贝坏区文件、合并文件、测试文件拷贝速度的有效工具。 你遇到过下面的问题吗? 1....2.你的文件被截断了;3.你需要合并同一个文件...... ... 当你的磁盘坏了的时候,你...

    scipy机器学习必备工具2

    这是2哦,还有1,记得一块下下来 运行环境Windows下python3.3

    直接复制busybox到system/bin下

    直接将busybox文件复制到system下的bin文件夹就行了,无需安装!

    copying.txt

    本篇文章将重点介绍 Dev-C++ 所需的“copying.txt”文件及其包含的重要内容——GNU 通用公共许可证(GPL)。 #### 文件“copying.txt”的重要性 “copying.txt”文件是 Dev-C++ 分发包中的一个关键文档,其内容...

    《同步文件备份工具》(Super Flexible File Synchronizer Pro)更新v4.44

    There are powerful synchronization modes, including Standard Copying, Exact Mirror, and SmartTracking. Version 4 features a completely redesigned GUI with numerous improvements to make an extremely ...

    建模工具2.zip

    * Fixed copying/pasting in Item Editor * Fixed copying element into the same diagram * Fixed application exit when the first window is closed * Fixed instability when editing the element using Element...

    super-copier-2.zip_Creating_super copier

    Super Copier 2. GliGli Author, Yogi (http://supercopier.sfxteam.org/). The source code of the program, showing an example of creating an alternative to replace the mechanism of copying in Windows has ...

    FastCopy v2.08

    Support for mobile, coverage, copy (if the duplicate copy of new public add file), copy (Fijian not covered), copy (Fijian male size of copy date different files), copy (Fijian male copying new add ...

    TimesTen In-Memory Database Installation Guide

    - Unauthorized copying, reproduction, translation, broadcasting, modification, licensing, transmission, distribution, exhibition, performance, publication, or display of any part of the software is ...

    DBConvert for Firebird & MySQL v1.2.3 + patch

    Convert databases from Firebird / InterBase to MySQL or from ... Moreover, DBConvert for Firebird & MySQL is quite well for copying Firebird / InterBase database to another Firebird / InterBase database.

    superobject-ae34787216d2.zip

    6. **许可文件**:开源库通常会附带一个许可证文件(如 COPYING 或 LICENSE),描述了库的使用、修改和分发的条款。 7. **测试代码**:为了确保库的功能完整性和性能,可能还包含了一些测试用例或自动化测试脚本。 ...

    Synology Open Source Project:Synology NAS 附带的开源项目。-开源

    Synology DiskStation/RackStation 系列中包含的开源项目。 这些项目使用的许可证是不同的。 请参阅每个项目中的 LICENSE / COPYING / COPYRIGHT 文件或源代码中的任何公告。

    A JCL STEOP ABOUT COPYING PDS DATASET.

    A JCL STEOP ABOUT COPYING PDS DATASET.

    Oracle Solaris 11.3 Copying and Creating Package Repositories in

    Oracle Solaris 11.3 Copying and Creating Package Repositories in Oracle Solaris 11.3-104

    oracle 11g 安装图解

    - 完成Grid Infrastructure的安装后,可以继续安装Oracle Database 11g。 - 设置数据库安装路径,如`/u01/app/oracle`。 - 选择安装类型,通常选择“典型”安装模式。 2. **使用Database Configuration ...

    Android打包APK Sqlite一起打包成APK

    super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // 检查数据库是否已经存在 if (!isDatabaseExist(context)) { // 复制数据库文件 copy...

    uWdfArchiver

    这只是一个非常基本的实现! 该工具可以创建档案,供新飞飞(NewFlyFF)使用,这是当前 FlyFF 的中文版本。 用法 ###uWdfArchiver UI ui.wdf 将... 这是在 WTFPL 下发布的 - 许可证: ://www.wtfpl.net/txt/copying/

    stately

    例子stately copy ./test -o tmp/2021-03-14T15:41:06.334+0100DEBUGactions/copy.go:58Copying: test/foo2021-03-14T15:41:06.334+0100DEBUGactions/copy.go:58Copying: test/foo/c.txt2021-03-14T15:41:06.334+...

Global site tag (gtag.js) - Google Analytics