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 來進行實例的複製。

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章