微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

通过HP 3PAR存储底层快照技术,快速启动测试数据库


#基于HP 3Par快照同步技术的数据库快速复制

生产集群数据库,通过存储底层复制技术生成快照数据,利用快照数据,可以将数据库快速打开,新的数据库可以用于测试,恢复等用途。

    下面是启动快速数据库的具体步骤,底层复制操作由存储厂家完成。
  1. 确认主机环境信息

    fgscrmdb#[/]machinfo
    fgscrmdb#[/]hostname
  2. 检查3Par存储挂载情况 (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 "$1}' > /tmp/3pardisk.pubdb.chown
fgscrmdb#[/]3parinfo -i | grep pubdb | awk '{print "chmod 660 "$1}' > /tmp/3pardisk.pubdb.chmod

fgscrmdb#[/]sh /tmp/3pardisk.pubdb.chown
fgscrmdb#[/]sh /tmp/3pardisk.pubdb.chmod


4. grid用户进行ASM磁盘组磁盘发现扫描

grid@fgscrmdb:[/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用户进行新增磁盘组挂载

grid@fgscrmdb:[/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资源中磁盘组信息

grid@fgscrmdb:[/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


grid@fgscrmdb:[/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文件并调整参数值

grid@fgscrmdb:[/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

oracle@fgscrmdb:[/home/oracle]cd $ORACLE_HOME/dbs
oracle@fgscrmdb:[/oracle/app/oracle/11.2.0.4/db_1/dbs]cp /tmp/*.ora ./

oracle@fgscrmdb:[/oracle/app/oracle/11.2.0.4/db_1/dbs]strings spfilepubdb.ora > initpubdb.ora
oracle@fgscrmdb:[/oracle/app/oracle/11.2.0.4/db_1/dbs]vi initpubdb.ora


#以__开头的参数为数据库记录的动态参数,这些内容可以删除

._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需要改为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'

#与实例相关的参数需要进行修改删除节点2的内容,并修改节点1的值为
.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. 创建必要的目录
`oracle@fgscrmdb:[/oracle/app/oracle/11.2.0.4/db_1/dbs]mkdir -p /oracle/app/oracle/admin/pubdb/adump`

9. 创建口令文件
`oracle@fgscrmdb:[/oracle/app/oracle/11.2.0.4/db_1/dbs]orapwd file=orapwpubdb password=08080808`

10. 调整oracle可执行程序权限,不调整权限的情况下,oracle用户无法访问磁盘组内容

oracle@fgscrmdb:[/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

oracle@fgscrmdb:[/home/oracle]su - grid
grid@fgscrmdb:[/home/grid]cd $ORACLE_HOME/bin
grid@fgscrmdb:[/grid/app/11.2.0.4/grid/bin]./setasmgidwrap o=/oracle/app/oracle/11.2.0.4/db_1/bin/oracle

grid@fgscrmdb:[/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重启数据库实例)

oracle@fgscrmdb:[/oracle/app/oracle/11.2.0.4/db_1/dbs]rm spfilepubdb.ora

oracle@fgscrmdb:[/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

oracle@fgscrmdb:[/home/oracle]srvctl add database -d pubdb -n pubdb -o $ORACLE_HOME -p $ORACLE_HOME/dbs/spfilepubdb.ora

oracle@fgscrmdb:[/home/oracle]srvctl config database -d pubdb


13. 测试通过集群启停数据库资源

oracle@fgscrmdb:[/home/oracle]srvctl start database -d pubdb
oracle@fgscrmdb:[/home/oracle]crsctl stat res -t


                
                                 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐