<< 返回文章列表

【云端起舞】Oracle公有云上创建克隆数据库- Create a database clone in the cloud

2017年1月3日
Joel Pérez,Kamran Aghayev A
4243

作者介绍:

作者.jpg

Joel Perez:Oracle ACE总监, Maximum Availability OCM,OTN 专家,全球第一批ACE称号获得者,致力于数据库高可用、灾难恢复、升级迁移和数据复制等方向设计和实现解决方案。

Kamran Aghayev :Oracle ACE总监,OCM、OCCE、RAC实施专家。在AzerCell Telecom LLC担任DBA团队主管。出版书籍《Expert secrets for using RMAN and Data Pump》、《Oracle Certified Master 11G Exam Guide


In this step by step article, we will create a clone database for the development or testing purposes.

Using Oracle Database Cloud service you don’t need to configure and run DUPLICATE command of RMAN and create a clone of production database for developers team. All you need is to create a snapshot of your production database and clone it in a few minutes.

 

这篇文章我们将会创建一个克隆数据库作为开发货真测试的环境。使用Oracle Database Cloud service创建克隆数据库,不需要配置或者执行通过RMAN执行DUPLICATE,只需要对生产库做一次快照,然后进行克隆,这个过程很快就完成了。


So first of all, let’s create a new database. Open cloud.oracle.com, login with your credentials and create a new database service.


首先,我们先创建一个新的数据库。打开网址:cloud.oracle.com,登录之后先创建一个 数据库服务。


After successfully creating a new database open it and select Administration section


创建成功以后,打开数据库,并切换到管理员页面。


01.png


Before creating a snapshot of the database, login to the database and create a new table, insert one row and commit the transaction. We will check this table after cloning the snapshot


在创建快照之前,首先登录到数据库创建一张表,插入一些数据并提交事务,这用于我们克隆完成之后进行数据验证。


02.png


Next, switch to the Snapshots tab, click “Create Storage Snapshot” button and provide the name of the snapshot. Don’t click Create button


然后,在页面上切换到快照的选项,点击“Create Storage Snapshot”按钮,填写快照名。切记,此时还不能按创建的按钮。


Next, switch to the Snapshots tab, click “Create Storage Snapshot” button and provide the name of the snapshot. Don’t click Create button


然后,在页面上切换到快照的选项,点击“Create Storage Snapshot”按钮,填写快照名。切记,此时还不能按创建的按钮。


03.png


When the snapshot of the database is taken, the database is placed into the backup mode. To test it, open SQL connection, click on Create button to create a snapshot and switch to the SQL session and run a command. The session will hang


当快照创建好以后,数据库此时处于备份模式。我们来验证一下,打开SQL命令行连接,点击创建按钮,然后切换到SQL会话并创建一张表,此时SQL会hang住,不能正常执行。


04.png


05.png

When the snapshot is created, click on the menu icon on the right and choose Create Database Clone to create a clone database from the snapshot。


快照创建好以后,从页面右边 的菜单栏选择通过快照创建克隆数据库。


06.png


Next, provide the service name and the database name for the clone database and create it。


然后,根据提示填写服务名和克隆数据库名进行创建。


07.png


After few minutes the clone database will be created


这个过程很快就会完成。


08.png


Now login to the clone database and check the table that was created before


现在登录到克隆数据库,检查之前创建的那张表。


09.png


The first table was created before the snapshot and thus it’s there. But the second table was create after creating a snapshot and is not available.


我们发现,在快照之前创建的那张表存在,但创建克隆数据库之后的那张表查不到。


As you see, it’s very easy to create a clone database using snapshots in Oracle Cloud. By having a trial account you are provided 500Gb of free space. Each database service consumes 150Gb space, so having 1 production db (150Gb), 1 snapshot (150Gb) and 1 clone database (150Gb) you can easily test the clone database creation with your trial account。


在Oracle Cloud 服务上创建克隆数据库是非常方便的,在每一个实验的账号上,会有500G的免费存储空间,假如每一个数据库服务分配150G,那么仅仅在实验账号上我们就可以创建一个生产数据库,一个快照数据库和一个克隆数据库。