|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
虽然可以将一个droptable语句转换成先delete再删表,性能却会降低很多。这里我们用上面说道的另外一种可用数据:“操作前数据备份”。创立|数据|数据库
创立物理备用数据库
在创立物理备用数据库之前先检察主数据库的一些信息和对主数据库做好设置.
将主数据库置为FORCELOGGING形式.在主数据库创立以后做以下操纵:
SQL>ALTERDATABASEFORCELOGGING;
确认主数据库是回档的并界说好当地回档.以下:
SQL>ALTERSYSTEMSETLOG_ARCHIVE_DEST_1=LOCATION=e:oracleoradataorclarchiveMANDATORYSCOPE=BOTH;
在主节点a确认主数据库的数据文件的地位和文件名.
SQL>selectnamefromv$datafile;
NAME
-----------------------------------------------------------------------------------------------------------
E:ORACLEORA92ORCLYSTEM01.DBF
E:ORACLEORA92ORCLUNDOTBS01.DBF
E:ORACLEORA92ORCLCWMLITE01.DBF
E:ORACLEORA92ORCLDRSYS01.DBF
E:ORACLEORA92ORCLEXAMPLE01.DBF
E:ORACLEORA92ORCLINDX01.DBF
E:ORACLEORA92ORCLODM01.DBF
E:ORACLEORA92ORCLTOOLS01.DBF
E:ORACLEORA92ORCLUSERS01.DBF
E:ORACLEORA92ORCLXDB01.DBF
做下面查询得出来的数据文件的物理备份.将其备份到一个一时的地位中.
SQL>SHUTDOWNIMMEDIATE;
SQL>EXIT
将E:ORACLEORA92ORCL全部目次COPY到a节点的F盘的oracle目次下.
在拷贝完以后再启动数据库
SQL>STARTUP;
SQL>ARCHIVELOGLIST;
在主节点a为备用数据库创立备用把持文件
SQL>ALTERDATABASECREATESTANDBYCONTROLFILEAS‘f:oracletdbycon.ctl’;
创立初始化参数文件
SQL>CREATEPFILE=’f:oracleinitstdbyorcl.ora’FROMSPFILE;
将下面几步所失掉的文件从主节点a拷贝到备用节点b上.
修正并增加一些参数后以下:
*.aq_tm_processes=1
*.background_dump_dest=e:oracleadminorcldump
*.compatible=9.2.0.0.0
*.control_files=e:oracleora92TANDBYTDBYCON.CTL,e:oracleora92TANDBYTDBYCON02.CTL,e:oracleora92TANDBYTDBYCON03.CTL
*.core_dump_dest=e:oracleadminTANDBYcdump
*.db_block_size=16384
*.db_cache_size=137363456
*.db_domain=
*.db_file_multiblock_read_count=16
*.db_name=orcl
*.dispatchers=(PROTOCOL=TCP)(SERVICE=orclXDB)
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name=orcl2
*.java_pool_size=33554432
*.job_queue_processes=10
*.large_pool_size=27262976
*.log_archive_dest_1=LOCATION=e:oracleoradataTANDBYarchiveMANDATORY
*.log_archive_format=log%d_%t_%s.arc
*.log_archive_start=true
*.open_cursors=300
*.pga_aggregate_target=80000000
*.processes=150
*.query_rewrite_enabled=FALSE
*.remote_login_passwordfile=EXCLUSIVE
*.shared_pool_size=45088768
*.sort_area_size=524288
*.sql_trace=FALSE
*.star_transformation_enabled=FALSE
*.timed_statistics=TRUE
*.undo_management=AUTO
*.undo_retention=10800
*.undo_tablespace=UNDOTBS1
*.user_dump_dest=e:oracleadminTANDBYudump
*.workarea_size_policy=AUTO
*.standby_file_management=AUTO
*.fal_server=ORCL
*.fal_client=ORCL2
*.standby_archive_dest=e:oracleoradatatandbytdarch
*.utl_file_dir=e:oracle
*.remote_archive_enable=TRUE
在备用数据库一端创立一个新的实例.以下操纵:
c:>oradim–new–sidorcl2–startmodem
将拷贝过去的文件放到e:oracleora92底下,并修正文件夹名为orcl2
修正e:oracleora92orcl2下的把持文件,将个中的control01.ora,control02.ora,control03.ora删失落,将f:oracletdbycon01.ora文件拷贝到e:oracleora92orcl2目次下.并复制和修正其名为stdbycon02.ora,stdbycon03.ora
在e:oracleadmin下创建orcl2文件夹,并在其底下创建三个文件夹,分离叫bdump,cdump,udump
在主节点a设置listner.ora和tnsnames.ora,sqlnet.ora设置后文件内容分离以下:
listener.ora文件为:
LISTENER=
(DESCRIPTION_LIST=
(DESCRIPTION_LIST=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.0.122)(PORT=1521))
)
)
(DESCRIPTION_LIST=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1))
)
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=PLSExtProc)
(ORACLE_HOME=e:oracleora92)
(PROGRAM=extproc)
)
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=e:/oracle/ora92)
(SID_NAME=orcl)
)
)
tnsnames.ora文件为:
ORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.0.122)(PORT=1521))
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
STANDBY=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.0.222)(PORT=1521))
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
EXTPROC_CONNECTION_DATA=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1))
)
(CONNECT_DATA=
(SID=PLSExtProc)
(PRESENTATION=RO)
)
)
sqlnet.ora文件为:
SQLNET.AUTHENTICATION_SERVICES=(NTS)
NAMES.DIRECTORY_PATH=(HOSTNAME,TNSNAMES,ONAMES)
在备用节点b设置listner.ora和tnsnames.ora,sqlnet.ora设置后文件内容分离以下:
个中设置sqlnet.ora文件中的参数sqlnet.expire_time是enable逝世毗连侦测
listener.ora文件为:
LISTENER=
(DESCRIPTION_LIST=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC))
)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.0.222)(PORT=1521))
)
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl2)
(ORACLE_HOME=e:oracleora92)
(SID_NAME=ORCL)
)
(SID_DESC=
(PROGRAM=extproc)
(SID_NAME=PLSExtProc)
(ORACLE_HOME=e:oracleora92)
)
)
tnsnames.ora文件为:
ORCL=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.0.122)(PORT=1521))
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
STANDBY=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.100.0.222)(PORT=1521))
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
EXTPROC_CONNECTION_DATA=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0))
)
(CONNECT_DATA=
(SID=PLSExtProc)
(PRESENTATION=RO)
)
)
sqlnet.ora文件为:
SQLNET.AUTHENTICATION_SERVICES=(NTS)
NAMES.DIRECTORY_PATH=(HOSTNAME,TNSNAMES,ONAMES)
SQLNET.EXPIRE_TIME=2
为备用数据库创立ServerParameterFile
createspfilefrompfile;
启动备用数据库为MOUNT形态
SQL>startupnomout
SQL>alterdatabasemountstandbydatabase;
初始logapplyservices
SQL>ALTERDATABASERECOVERMANAGEDSTANDBYDATABASEDISCONNECTFROMSESSION;
在主节点设置远程回档目次:
SQL>ALTERSYSTEMSETLOG_ARCHIVE_DEST_2=SERVICE=STANDBY’SCOPE=BOTH;
SQL>ALTERSYSTEMSETLOG_ARCHIVE_DEST_STATE_2=ENABLESCOPE=BOTH;
启动远程回档:
SQL>ALTERSYSTEMARCHIVELOGCURRENT;
确认远程回档乐成:
SQL>SELECTSEQUENCE#,FIRST_TIME,NEXT_TIME
2FROMV$ARCHIVED_LOGORDERBYSEQUENCE#;
SEQUENCE#FIRST_TIMENEXT_TIME
----------------------------------------------
811-JUL-0217:50:4511-JUL-0217:50:53
911-JUL-0217:50:5311-JUL-0217:50:58
1011-JUL-0217:50:5811-JUL-0217:51:03
3rowsselected.
如果某个数据列里包含许多重复的值,就算为它建立了索引也不会有很好的效果。比如说,如果某个数据列里包含的净是些诸如“0/1”或“Y/N”等值,就没有必要为它创建一个索引。 |
|