Oracle DBCA 命令 进行实例 复制 说明

 

在我们创建实例的时候可以保存为模板,其实也可以直接用DBCA命令来创建我们的实例模板,并且利用这个功能进行实例的复制。只是这个功能很少被关注。


 

 

这里我们选择ManageTemplate:

 


注意创建模板的三种类型,官网也有相关的说明:

Installing Oracle Database and Creating aDatabase

http://docs.oracle.com/cd/E11882_01/server.112/e10897/install.htm#ADMQS023

 

(1)From an existing template

Using anexisting template, you can create a new template based on the predefinedtemplate settings. You can add or change any template settings such asinitialization parameters, storage parameters, or whether to use customscripts.

--根据已经存在的模板来创建新的模板,在此基础之上可以修改旧模板的参数。

 

(2)From an existing database(structure only)

You can create anew template that contains structural information from an existing database,including database options, tablespaces, data files, and initializationparameters. User-defined schemas and their data will not be part ofthe created template. The source database can be either local or remote. Selectthis option when you want the new database to be structurally similar to thesource database, but not contain the same data.

--根据已经存在的数据库实例来创建新的模板,这种只包含structural 的信息,如database options,tablespaces,datafiles 和initialization parameters。 用户定义的schemas 和data 不会被包含在模版中。因此这种模板只包含基本的架构信息。

 

(3)From an existing database(structure as well as data)

You can create anew template that has both the structural information and physical data filesof an existing database. Databases created using such a template are identicalto the source database. User-defined schemas and their data will bepart of the created template. The source database must be local. Select thisoption when you want a template from which you can create an exact replica ofthe source database.

       这种模板是包含架构和数据,因此这个模板的数据和我们源库会完全相同,使用这个功能可以用来进行数据的复制。 这个功能是我们需要关注的,也是我写这篇Blog的一个目的。

 

 

模板存放的目录:

{ORACLE_HOME}/assistants/dbca/templates/dave.dfb

 




 

这里选择No,退出:

 

查看一下我们生成模板的大小:

DG1:/u01/app/oracle/product/11.2.0.3/db_1/assistants/dbca/templates>ll -lh

total 555M

-rw-r--r-- 1 oracle oinstall 5.0K Sep 1710:24 Data_Warehouse.dbc

-rw-r----- 1 oracleoinstall 9.3M Dec 14 17:56 dave.ctl

-rw-r----- 1 oracleoinstall 6.2K Dec 14 17:58 dave.dbc

-rw-r----- 1 oracleoinstall 260M Dec 14 17:56 dave.dfb

-rwxrw-rwx 1 oracle oinstall  21M Sep 22 15:22 example01.dfb

-rwxrw-rwx 1 oracle oinstall 1.5M Sep 2215:22 example.dmp

-rw-r--r-- 1 oracle oinstall 4.9K Sep 1710:24 General_Purpose.dbc

-rw-r--r-- 1 oracle oinstall  12K Feb 15 2010 New_Database.dbt

-rwxrw-rwx 1 oracle oinstall 9.3M Sep 2215:21 Seed_Database.ctl

-rwxrw-rwx 1 oracle oinstall 254M Sep 2215:22 Seed_Database.dfb

 

 

这里的模板有几种不同的扩展名,官网对扩展名的解释如下:

 

Type

File Extension

Includes Data Files

Database Structure

Seed

.dbc

Yes

This type of template contains both the structure and the physical data files of an existing database, referred to as the seed database. Your new database starts as a copy of the seed database, and requires only the following changes:

  • Name of the database
  • Destination of the data files
  • Number of control files
  • Number of online redo log groups
  • Initialization parameters

Other changes can be made after database creation using custom scripts that can be invoked by DBCA, command-line SQL statements, or Oracle Enterprise Manager Database Control.

The data files for the seed database are stored in compressed RMAN backup format in a file with a .dfb extension. The seed database control file is stored in a file with .ctl extension. (This file is needed only when storing data files in Oracle Automatic Storage Management (Oracle ASM) disk groups or as Oracle Managed Files.) The .dbc file contains the location of the seed database data files and contains the source database name used to mount the control file.

Nonseed

.dbt

No

This type of template is used to create a new database. It contains the characteristics of the database to be created. Nonseed templates are more flexible than their seed counterparts because all data files and online redo log files are created to your specification, and names, sizes, and other attributes can be changed as required.

 

根据上面的说明,dfb 是一个RMAN 压缩备份的文件,ctl保存的是控制文件,dbc 包含data files 等文件的位置信息。

 

当我们创建完之后,就可以利用这个模板来进行实例复制,因为这个模板和源实例一模一样,所以如果在同一台server 创建,就需要修改一些参数值,在创建实例的时候可以直接修改这些参数的值,如下图:

 

 

 

小结:

      此篇Blog主要讲一个内容:可以利用DBCA 来进行实例的复制。

 

 

 

 

 

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

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Blog:     http://blog.csdn.net/tianlesoftware

Weibo: http://weibo.com/tianlesoftware

Email:   tianlesoftware@gmail.com

Skype: tianlesoftware

 

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823

DBA6 群:158654907    DBA7 群:172855474  

posted @ 2011-12-14 20:07  hibernate我最强  阅读(192)  评论(0编辑  收藏  举报