Rapid database replication #基于HP 3Par Snapshot synchronization technology
生产集群数据库,通过存储底层复制技术生成快照数据,利用快照数据,可以将数据库快速打开,新的数据库可以用于测试,恢复等用途。 下面是启动快速数据库的具体步骤,底层复制操作由存储厂家完成。
Confirm Host Environment Information
fgscrmdb#[/]machinfofgscrmdb#[/]hostname
- Check 3Par storage mount (Root)
fgscrmdb#[/]3parinfo -i
Device File Name Size [MB]
==================================================
/dev/rdisk/disk212 1024
/dev/rdisk/disk213 1024
/dev/rdisk/disk214 1024
/dev/rdisk/disk215 1024
/dev/rdisk/disk216 1024
/dev/rdisk/disk217 512000
/dev/rdisk/disk218 512000
/dev/rdisk/disk219 512000
/dev/rdisk/disk220 512000
/dev/rdisk/disk221 512000
/dev/rdisk/disk222 512000
/dev/rdisk/disk223 512000
/dev/rdisk/disk224 512000
/dev/rdisk/disk225 512000
/dev/rdisk/disk226 512000
/dev/rdisk/disk227 512000
/dev/rdisk/disk228 512000
/dev/rdisk/disk229 512000
/dev/rdisk/disk230 512000
/dev/rdisk/disk231 512000
/dev/rdisk/disk232 512000
/dev/rdisk/disk233 512000
/dev/rdisk/disk234 512000
/dev/rdisk/disk235 512000
/dev/rdisk/disk236 512000
/dev/rdisk/disk237 512000
/dev/rdisk/disk238 512000
/dev/rdisk/disk239 512000
/dev/rdisk/disk240 512000
/dev/rdisk/disk241 512000
/dev/rdisk/disk242 512000
/dev/rdisk/disk243 512000
/dev/rdisk/disk244 512000
/dev/rdisk/disk245 512000
/dev/rdisk/disk246 512000
/dev/rdisk/disk247 512000
/dev/rdisk/disk248 512000
/dev/rdisk/disk249 512000
/dev/rdisk/disk250 512000
/dev/rdisk/disk251 512000
/dev/rdisk/disk252 512000
/dev/rdisk/disk253 512000
/dev/rdisk/disk254 512000
/dev/rdisk/disk255 512000
/dev/rdisk/disk256 512000
/dev/rdisk/disk257 512000
/dev/rdisk/disk258 512000
/dev/rdisk/disk259 512000
/dev/rdisk/disk260 512000
/dev/rdisk/disk261 512000
/dev/rdisk/disk262 512000
3. 修改3Par存储磁盘属组和权限 (root)
Fgscrmdb#[/]3parinfo-i | grep pubdb | awk ' {print ' chown grid:asmadmin ' $ ' >/tmp/3pardisk.pubdb.chown
Fgscrmdb#[/]3parinfo-i | grep pubdb | awk ' {print ' chmod 660 ' $ ' >/tmp/3pardisk.pubdb.chmod
Fgscrmdb#[/]sh/tmp/3pardisk.pubdb.chown
Fgscrmdb#[/]sh/tmp/3pardisk.pubdb.chmod
4. grid用户进行ASM磁盘组磁盘发现扫描
[Email protected]:[/home/grid]kfod a= '/dev/rdisk/* ' Disks=all ds=true o=all
Disk Size Path
========================================
1:1024 mb/dev/rdisk/disk212
2:1024 mb/dev/rdisk/disk213
3:1024 mb/dev/rdisk/disk214
4:1024 mb/dev/rdisk/disk215
5:1024 mb/dev/rdisk/disk216
6:512000 mb/dev/rdisk/disk217
7:512000 mb/dev/rdisk/disk218
8:512000 mb/dev/rdisk/disk219
9:512000 mb/dev/rdisk/disk220
10:512000 mb/dev/rdisk/disk221
11:512000 mb/dev/rdisk/disk222
12:512000 mb/dev/rdisk/disk223
13:512000 mb/dev/rdisk/disk224
14:512000 mb/dev/rdisk/disk225
15:512000 mb/dev/rdisk/disk226
16:512000 mb/dev/rdisk/disk227
17:512000 mb/dev/rdisk/disk228
18:512000 mb/dev/rdisk/disk229
19:512000 mb/dev/rdisk/disk230
20:512000 mb/dev/rdisk/disk231
21:512000 mb/dev/rdisk/disk232
22:512000 mb/dev/rdisk/disk233
23:512000 mb/dev/rdisk/disk234
24:512000 mb/dev/rdisk/disk235
25:512000 mb/dev/rdisk/disk236
26:512000 mb/dev/rdisk/disk237
27:512000 mb/dev/rdisk/disk238
28:512000 mb/dev/rdisk/disk239
29:512000 mb/dev/rdisk/disk240
30:512000 mb/dev/rdisk/disk241
31:512000 mb/dev/rdisk/disk242
32:512000 mb/dev/rdisk/disk243
33:512000 mb/dev/rdisk/disk244
34:512000 mb/dev/rdisk/disk245
35:512000 mb/dev/rdisk/disk246
36:512000 mb/dev/rdisk/disk247
37:512000 mb/dev/rdisk/disk248
38:512000 mb/dev/rdisk/disk249
39:512000 mb/dev/rdisk/disk250
40:512000 mb/dev/rdisk/disk251
41:512000 mb/dev/rdisk/disk252
42:512000 mb/dev/rdisk/disk253
43:512000 mb/dev/rdisk/disk254
44:512000 mb/dev/rdisk/disk255
45:512000 mb/dev/rdisk/disk256
46:512000 mb/dev/rdisk/disk257
47:512000 mb/dev/rdisk/disk258
48:512000 mb/dev/rdisk/disk259
49:512000 mb/dev/rdisk/disk260
50:512000 mb/dev/rdisk/disk261
51:512000 mb/dev/rdisk/disk262
Oracle_sid Oracle_home
+ASM /grid/app/11.2.0.4/grid
5. grid用户进行新增磁盘组挂载
[Email Protected]:[/home/grid]sqlplus/as sysasm
Sql> alter DiskGroup PUBDBDATA_DG Mount;
Sql> alter DiskGroup YYDBADATA_DG Mount;
Sql> alter DiskGroup YYDBBDATA_DG Mount;
6. 检查crs资源中磁盘组信息
[Email protected]:[/home/grid]crsctl stat res-t
NAME TARGET State SERVER State_details
Local Resources
Ora. Fgscrm_ocrdg.dg
Online online Fgscrmdb
Ora. Listener.lsnr
Online online Fgscrmdb
Ora. Pubdbdata_dg.dg
Online online Fgscrmdb
Ora. Yydbadata_dg.dg
Online online Fgscrmdb
Ora. Yydbbdata_dg.dg
Online online Fgscrmdb
Ora.asm
Online online Fgscrmdb Started
Ora.ons
OFFLINE OFFLINE Fgscrmdb
[Email Protected]:[/home/grid]sqlplus/as sysasm
Sql> Show parameter asm;
NAME TYPE VALUE
Asm_diskgroups string pubdbdata_dg, YYDBADATA_DG, YY
Dbbdata_dg
Asm_diskstring string/dev/rdisk/disk*
7. 创建原有生产数据库的pfile文件并调整参数值
[Email Protected]:[/home/grid]asmcmd
Asmcmd> find--type parameterfile./*
+pubdbdata_dg/pubdb/parameterfile/spfile.267.923089341
+pubdbdata_dg/pubdb/spfilepubdb.ora
+yydbadata_dg/yydba/parameterfile/spfile.267.923058269
+yydbadata_dg/yydba/spfileyydba.ora
+yydbbdata_dg/yydbb/parameterfile/spfile.267.923059267
+yydbbdata_dg/yydbb/spfileyydbb.ora
asmcmd> CP +pubdbdata_dg/pubdb/spfilepubdb.ora/tmp
Copying +pubdbdata_dg/pubdb/spfilepubdb.ora-/tmp/spfilepubdb.ora
asmcmd> CP +yydbadata_dg/yydba/spfileyydba.ora/tmp
Copying +yydbadata_dg/yydba/spfileyydba.ora-/tmp/spfileyydba.ora
asmcmd> CP +yydbbdata_dg/yydbb/spfileyydbb.ora/tmp
Copying +yydbbdata_dg/yydbb/spfileyydbb.ora-/tmp/spfileyydbb.ora
[Email PROTECTED]:[/HOME/ORACLE]CD $ORACLE _home/dbs
[Email Protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]cp/tmp/*.ora./
[Email protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]strings spfilepubdb.ora > Initpubdb.ora
[Email Protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]vi Initpubdb.ora
#以__开头的参数为数据库记录的动态参数, the content can be deleted
. _gby_hash_aggregation_enabled=false
. _gc_policy_time=0
. _high_priority_processes= ' vktm| lms| LGWR '
. _memory_imm_mode_without_autosga=false
. _optim_peek_user_binds=false
. _optimizer_adaptive_cursor_sharing=false
. _optimizer_cartesian_enabled=false
. _optimizer_extended_cursor_sharing= ' NONE '
. _optimizer_extended_cursor_sharing_rel= ' NONE '
. _optimizer_use_feedback=false
. _px_use_large_pool=true
. _undo_autotune=false
. _use_adaptive_log_file_sync= ' FALSE '
. audit_trail= ' DB '
. commit_logging= ' BATCH '
. compatible= ' 11.2.0.4.0 '
. control_files= ' +pubdbdata_dg/pubdb/controlfile/current.345.930096785 ' #Restore controlfile
. db_block_size=8192
. db_create_file_dest= ' +PUBDBDATA_DG '
. db_domain= '
. db_files=10000
. Db_name= ' Pubdb '
. Deferred_segment_creation=false
. diagnostic_dest= '/oracle/app/oracle '
. dispatchers= ' (protocol=tcp) (SERVICE=PUBDBXDB)
. event= ' 28401 Trace name context FOREVER, level 1:10949 trace name Context FOREVER '
. fast_start_parallel_rollback= ' High '
. open_cursors=1000
. parallel_force_local=true
. processes=8000
. recyclebin= ' OFF '
. remote_login_passwordfile= ' Exclusive '
. session_cached_cursors=500
. sessions=1655
*.undo_retention=10800
#需要进行调整的参数, Cluster_database needs to be changed to False
*.cluster_database=false
#需要注意创建必要的目录结构
*.audit_file_dest= '/oracle/app/oracle/admin/pubdb/adump '
#需要删除的参数
. log_archive_dest_1= ' LOCATION=+PUBDBARCH_DG '
. remote_listener= ' pubdb-scan:1521 '
#与实例相关的参数需要进行修改, delete the contents of Node 2 and modify the value of node 1 to
. instance_number=1
. thread=1
. undo_tablespace= ' UNDOTBS1 '
#内存参数需要进行调整
. sga_max_size=100g
. sga_target=0
. db_cache_size=60g
. shared_pool_size=20g
. large_pool_size=2g
. pga_aggregate_target=20g
8. 创建必要的目录`[email protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]mkdir -p /oracle/app/oracle/admin/pubdb/adump`9. 创建口令文件`[email protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]orapwd file=orapwpubdb password=08080808`10. 调整oracle可执行程序权限,不调整权限的情况下,oracle用户无法访问磁盘组内容
[Email Protected]:[/oracle/app/oracle/11.2.0.4/db_1/bin]ls-la Oracle
-rwsr-s--x 1 Oracle Oinstall 574113064 Mar 9 09:41 Oracle
[Email Protected]:[/home/oracle]su-grid
[Email PROTECTED]:[/HOME/GRID]CD $ORACLE _home/bin
[Email Protected]:[/grid/app/11.2.0.4/grid/bin]./setasmgidwrap o=/oracle/app/oracle/11.2.0.4/db_1/bin/oracle
[Email protected]:[/grid/app/11.2.0.4/grid/bin]ls-la/oracle/app/oracle/11.2.0.4/db_1/bin/oracle
-rwsr-s--x 1 Oracle asmadmin 574113064 Mar 9 09:41/oracle/app/oracle/11.2.0.4/db_1/bin/oracle
11. 创建spfile参数文件,启动实例进行测试 (先通过pfile启动进行验证,正确后,创建spfile,并用spfile重启数据库实例)
[Email Protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]rm Spfilepubdb.ora
[Email Protected]:[/oracle/app/oracle/11.2.0.4/db_1/dbs]export oracle_sid=pubdb
sql> startup Nomount;
Sql> create SPFile from Pfile;
sql> startup Force Nomount;
Sql> ALTER DATABASE Mount;
sql> ALTER DATABASE Noarchivelog;
sql> ALTER DATABASE open;
sql> shutdown immediate;
12. 注册数据库资源
-d <db_unique_name> Unique name for the database-n <db_name> Database name (DB_NAME), if different from the unique name given by the -d option-o <oracle_home> ORACLE_HOME path-p <spfile> Server parameter file path-a "<diskgroup_list>" Comma separated list of disk groups
[Email protected]:[/home/oracle]srvctl add database-d pubdb-n pubdb-o $ORACLE _home-p $ORACLE _home/dbs/spfilepubdb.ora
[Email protected]:[/home/oracle]srvctl config database-d pubdb
13. 测试通过集群启停数据库资源
[Email protected]:[/home/oracle]srvctl start database-d pubdb
[Email protected]:[/home/oracle]crsctl stat res-t
Quickly launch a test database with HP 3PAR storage underlying snapshot technology