小编给大家分享一下oracle中数据fs到asm迁移的示例分析,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!(RedHat10gOracle环境)1、配置OracleClusterSynchronization(CSS)要想使用ASM,必须先配置并启动CSS[root@redhat10g~]#cd/u01/app/oracle/product/10.2.0/db_1/bin[root@redhat10gbin]#./localconfigadd2、配置AutomaticStorageManagement(ASM)实例参数[oracle@aix201~]$vi/u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.orainstance_type=’asm’asm_diskstring=’/dev/mapper/asmvg-*’asm_diskgroups=’DG1′,’RCY1’large_pool_size=12mbackground_dump_dest=/u01/app/oracle/product/10.2.0/db_1/admin/+ASM/bdumpcore_dump_dest=/u01/app/oracle/product/10.2.0/db_1/admin/+ASM/cdumpuser_dump_dest=/u01/app/oracle/product/10.2.0/db_1/admin/+ASM/udump3、启动asm实例[oracle@redhat10g~]$exportORACLE_SID=+ASM[oracle@redhat10g~]$sqlplus/assysdbaSQL*Plus:Release10.2.0.1.0-ProductiononSunJun2917:04:442014Copyright(c)1982,2005,Oracle.Allrightsreserved.Connectedtoanidleinstance.SQL>startupASMinstancestartedTotalSystemGlobalArea83886080bytesFixedSize1217836bytesVariableSize57502420bytesASMCache25165824bytes4、创建裸设备,修改用户和权限1)添加磁盘;2)为磁盘分区:[root@redhat10g~]#fdisk/dev/sdbDeviceBootStartEndBlocksIdSystem/dev/sdb11261020964793+83Linux3)创建物理卷(pv):[root@redhat10g~]#pvcreate/dev/sdb1/dev/cdrom:openfailed:Read-onlyfilesystemAttempttoclosedevice’/dev/cdrom’whichisnotopen.Physicalvolume”/dev/sdb1″successfullycreated查看pv的信息:4)创建卷组:[root@redhat10g~]#vgcreateasmvg/dev/sdb15)创建逻辑卷lv:[root@redhat10g~]#lvcreate-ndatalv1-L5gbasmvg/dev/cdrom:openfailed:Read-onlyfilesystemLogicalvolume”datalv1″created[root@redhat10g~]#lvcreate-ndatalv2-L5gbasmvg/dev/cdrom:openfailed:Read-onlyfilesystemLogicalvolume”datalv2″created[root@redhat10g~]#lvcreate-nocrdisklv1-L4.5gbasmvg/dev/cdrom:openfailed:Read-onlyfilesystemLogicalvolume”ocrdisklv1″created[root@redhat10g~]#lvcreate-nocrdisklv2-L4.5gbasmvg/dev/cdrom:openfailed:Read-onlyfilesystemLogicalvolume”ocrdisklv2″created6)绑定裸设备:[root@redhat10g~]#raw/dev/raw/raw1/dev/mapper/asmvg-datalv1/dev/raw/raw1:boundtomajor253,minor2[root@redhat10g~]#raw/dev/raw/raw2/dev/mapper/asmvg-datalv2/dev/raw/raw2:boundtomajor253,minor3[root@redhat10g~]#raw/dev/raw/raw3/dev/mapper/asmvg-asmvg-datalv1asmvg-datalv2asmvg-ocrdisklv1asmvg-ocrdisklv2[root@redhat10g~]#raw/dev/raw/raw3/dev/mapper/asmvg-ocrdisklv1/dev/raw/raw3:boundtomajor253,minor4[root@redhat10g~]#raw/dev/raw/raw4/dev/mapper/asmvg-ocrdisklv2/dev/raw/raw4:boundtomajor253,minor5服务器启动自动挂载裸设备:[root@redhat10g~]#vi/etc/sysconfig/rawdevices/dev/raw/raw1/dev/mapper/asmvg-datalv1/dev/raw/raw2/dev/mapper/asmvg-datalv2/dev/raw/raw3/dev/mapper/asmvg-ocrdisk1/dev/raw/raw4/dev/mapper/asmvg-ocrdisk2重启服务验证能否挂载:[root@redhat10g~]#servicerawdevicesrestartAssigningdevices:/dev/raw/raw1–>/dev/mapper/asmvg-datalv1/dev/raw/raw1:boundtomajor253,minor2/dev/raw/raw2–>/dev/mapper/asmvg-datalv2/dev/raw/raw2:boundtomajor253,minor3/dev/raw/raw3–>/dev/mapper/asmvg-ocrdisklv1/dev/raw/raw3:boundtomajor253,minor4/dev/raw/raw4–>/dev/mapper/asmvg-ocrdisklv2/dev/raw/raw4:boundtomajor253,minor57)修改设备属性:[root@redhat10graw]#chown-Roracle:oinstall/dev/raw/raw1[root@redhat10graw]#chown-Roracle:oinstall/dev/raw/raw2[root@redhat10graw]#chown-Roracle:oinstall/dev/raw/raw3[root@redhat10graw]#chown-Roracle:oinstall/dev/raw/raw4[root@redhat10g~]#chown-Roracle:oinstall/dev/mapper/asmvg-datalv1[root@redhat10g~]#chown-Roracle:oinstall/dev/mapper/asmvg-datalv2[root@redhat10g~]#chown-Roracle:oinstall/dev/mapper/asmvg-ocrdisklv1[root@redhat10g~]#chown-Roracle:oinstall/dev/mapper/asmvg-ocrdisklv25、创建ASM磁盘组
为了能使ASM启动时,自动挂载磁盘和磁盘组,将下边的参数添加到初始化文件中:asm_diskstring=’/dev/mapper/asmvg-*’asm_diskgrou免费主机域名ps=’DG1′,’RCY1’6、修改参数:SQL>altersystemsetdb_create_file_dest=’+dg1’scope=spfile;Systemaltered.SQL>altersystemsetcontrol_files=’+dg1’scope=spfile;Systemaltered.7、转储控制文件RMAN>shutdownimmediate;usingtargetdatabasecontrolfileinsteadofrecoverycatalogdatabasecloseddatabasedismountedOracleinstanceshutdownRMAN>startupnomount;connectedtotargetdatabase(notstarted)OracleinstancestartedTotalSystemGlobalArea1258291200bytesFixedSize1219160bytesVariableSize318768552bytesDatabaseBuffers922746880bytesRedoBuffers15556608bytesRMAN>restorecontrolfilefrom’/u01/app/oracle/oradata/prod/control01.ctl’;Startingrestoreat29-JUN-14allocatedchannel:ORA_DISK_1channelORA_DISK_1:sid=156devtype=DISKchannelORA_DISK_1:copiedcontrolfilecopyoutputfilename=+DG1/prod/controlfile/backup.256.851554395Finishedrestoreat29-JUN-148、转储数据文件RMAN>alterdatabasemount;databasemountedreleasedchannel:ORA_DISK_1RMAN>backupascopydatabaseformat’+dg1′;Startingbackupat29-JUN-14allocatedchannel:ORA_DISK_1channelORA_DISK_1:sid=156devtype=DISKchannelORA_DISK_1:startingdatafilecopyinputdatafilefno=00001name=/u01/app/oracle/oradata/prod/system01.dbfoutputfilename=+DG1/prod/datafile/system.257.851554507tag=TAG20140629T225507recid=8stamp=851554598channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:01:35channelORA_DISK_1:startingdatafilecopyinputdatafilefno=00003name=/u01/app/oracle/oradata/prod/sysaux01.dbfoutputfilename=+DG1/prod/datafile/sysaux.258.851554603tag=TAG20140629T225507recid=9stamp=851554652channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:56channelORA_DISK_1:startingdatafilecopyinputdatafilefno=00005name=/u01/app/oracle/oradata/prod/example01.dbfoutputfilename=+DG1/prod/datafile/example.259.851554659tag=TAG20140629T225507recid=10stamp=851554677channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:25channelORA_DISK_1:startingdatafilecopyinputdatafilefno=00002name=/u01/app/oracle/oradata/prod/undotbs01.dbfoutputfilename=+DG1/prod/datafile/undotbs1.260.851554683tag=TAG20140629T225507recid=11stamp=851554689channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:07channelORA_DISK_1:startingdatafilecopyinputdatafilefno=00004name=/u01/app/oracle/oradata/prod/users01.dbfoutputfilename=+DG1/prod/datafile/users.261.851554691tag=TAG20140629T225507recid=12stamp=851554691channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:03channelORA_DISK_1:startingdatafilecopycopyingcurrentcontrolfileoutputfilename=+DG1/prod/controlfile/backup.262.851554693tag=TAG20140629T225507recid=13stamp=851554696channelORA_DISK_1:datafilecopycomplete,elapsedtime:00:00:03channelORA_DISK_1:startingfulldatafilebackupsetchannelORA_DISK_1:specifyingdatafile(s)inbackupsetincludingcurrentSPFILEinbackupsetchannelORA_DISK_1:startingpiece1at29-JUN-14channelORA_DISK_1:finishedpiece1at29-JUN-14piecehandle=+DG1/prod/backupset/2014_06_29/nnsnf0_tag20140629t225507_0.263.851554697tag=TAG20140629T225507comment=NONEchannelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:01Finishedbackupat29-JUN-14RMAN>switchdatabasetocopy;datafile1switchedtodatafilecopy”+DG1/prod/datafile/system.257.851554507″datafile2switchedtodatafilecopy”+DG1/prod/datafile/undotbs1.260.851554683″datafile3switchedtodatafilecopy”+DG1/prod/datafile/sysaux.258.851554603″datafile4switchedtodatafilecopy”+DG1/prod/datafile/users.261.851554691″datafile5switchedtodatafilecopy”+DG1/prod/datafile/example.259.851554659″9、恢复数据库RMAN>recoverdatabase;Startingrecoverat29-JUN-14usingchannelORA_DISK_1startingmediarecoverymediarecoverycomplete,elapsedtime:00:00:00Finishedrecoverat29-JUN-14RMAN>alterdatabaseopen;databaseopened10、迁移临时表空间SQL>selectnamefromv$datafile;NAME——————————————————————————–+DG1/prod/datafile/system.257.851554507+DG1/prod/datafile/undotbs1.260.851554683+DG1/prod/datafile/sysaux.258.851554603+DG1/prod/datafile/users.261.851554691+DG1/prod/datafile/example.259.851554659SQL>selectnamefromv$tempfile;NAME——————————————————————————–/u01/app/oracle/oradata/prod/temp01.dbf/u01/app/oracle/product/10.2.0/db_1/dbs/temp01.dbf报错:SQL>altertablespacetempdroptempfile’/u01/app/oracle/product/10.2.0/db_1/dbs/temp01.dbf’;altertablespacetempdroptempfile’/u01/app/oracle/product/10.2.0/db_1/dbs/temp01.dbf’*ERRORatline1:ORA-00600:internalerrorcode,arguments:[droptempfile-2],[3],[7],[],[],[],[],[]11、迁移联机日志组:SQL>alterdatabaseaddlogfile(‘+dg1′,’+rcy1’)size10m;Databasealtered.SQL>alterdatabaseaddlogfile(‘+dg1′,’+rcy1’)size10m;Databasealtered.SQL>alterdatabaseaddlogfile(‘+dg1′,’+rcy1’)size10m;Databasealtered.SQL>selectgroup#,memberfromv$logfileorderby1;GROUP#MEMBER———————————————————————-1/u01/app/oracle/oradata/prod/redo01.log2/u01/app/oracle/oradata/prod/redo02.log3/u01/app/oracle/oradata/prod/redo03.log4+DG1/prod/onlinelog/group_4.265.8515565834+RCY1/prod/onlinelog/group_4.256.8515565855+DG1/prod/onlinelog/group_5.266.8515565915+RCY1/prod/onlinelog/group_5.257.8515565956+DG1/prod/onlinelog/group_6.267.8515免费主机域名565996+RCY1/prod/onlinelog/group_6.258.851556601SQL>alterdatabasedroplogfilegroup1;Databasealtered.SQL>alterdatabasedroplogfilegroup2;alterdatabasedroplogfilegroup2*ERRORatline1:ORA-01623:log2iscurrentlogforinstanceprod(thread1)-cannotdropORA-00312:onlinelog2thread1:’/u01/app/oracle/oradata/prod/redo02.log’SQL>alterdatabasedroplogfilegroup3;Databasealtered.由于第二组日志还没有归档所以现在无法删除,所以要切换日志,使日志组2变成非活动状态SQL>altersystemswitchlogfile;SQL>selectgroup#,members,statusfromv$log;GROUP#MEMBERSSTATUS————————————21INACTIVE42CURRENT52INACTIVE62INACTIVESQL>alterdatabasedroplogfilegroup2;Databasealtered.12、调整recoverarea参数SQL>showparameterrecoverNAMETYPEVALUE—————————————————————————–db_recovery_file_deststring/u01/app/oracle/flash_recovery_areadb_recovery_file_dest_sizebiginteger2Grecovery_parallelisminteger0SQL>altersystemsetdb_recovery_file_dest=’+rcy1’scope=spfile;Systemaltered.SQL>altersystemsetdb_recovery_file_dest_size=2gscope=spfile;Systemaltered以上是“oracle中数据fs到asm迁移的示例分析”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注云技术行业资讯频道!
这篇文章主要讲解了“怎么理解PostgreSQL行安全策略”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么理解PostgreSQL行安全策略”吧!行安全策略除可以通过GRANT使用 SQL 标准的 特权系统之…