|
能不能更改实例名
在数据库已经建库和使用后,能否更改已经设置好的实例名?如果可以的话,怎样更改?
老邱 回复于:2003-04-24 12:10:27
很麻烦。以下是oracle站上的一篇东西,不知道新版本是不是还适用。
Article-ID:<Note:15390.1>
Alias:OLS:106373.655
Circulation:PUBLISHED(EXTERNAL)
Folder:server.Rdbms.DBA.Admin
Topic:2.0DatabaseManagement
Title:HOWTODETERMINEANDCHANGEDB_NAMEORORACLE_SID
Document-Type:BULLETIN
Impact:MEDIUM
Skill-Level:NOVICE
Server-Version:07.0Xto08.0X
Updated-Date:05-JUL-200018:27:26
References:
Shared-Refs:
Authors:MAROBERT.USKBAHADUR.US
Attachments:NONE
Content-Type:TEXT/PLAIN
Keywords:CONFIGINFO;CREATEDB;
Products:5/RDBMS(V7.XtoV8.0.X);
Platforms:GENERIC;
PURPOSE
Thisentrydescribeshowtofindandchangethe"db_name"foradatabase,or
theORACLE_SIDforaninstance,withoutrecreatingthedatabase.
SCOPE&APPLICATION
ForDBAsrequiringtoeitherfindorchangethedb_nameorORACLE_SID.
RELATEDDOCUMENTS
<Note:1018634.102>AFTERRENAMINGTHEDATABASESELECTFROMDUALRETURNS
OLDDATABASENAME
<Note:9560.1>ALTERTABLESPACE/DATABASETORENAMEFILES
TofindthecurrentDB_NAMEandORACLE_SID:
===========================================
Querytheviewsv$databaseandv$thread.
V$DATABASEgivesDB_NAME
V$THREADgivesORACLE_SID
IfORACLE_SID=DB_SIDanddb_name=DBNAME:
TofindthecurrentvalueofORACLE_SID:
SVRMGR>selectinstancefromv$thread;
INSTANCE
----------------
DB_SID
TofindthecurrentvalueofDB_NAME:
SVRMGR>selectnamefromv$database;
NAME
---------
DBNAME
ModifyingadatabasetorununderanewORACLE_SID:
===================================================
1.Shutdowntheinstance
2.Backupallcontrol,redo,anddatafiles.
3.Gothroughthe.profile,.cshrc,.login,oratab,tnsnames.ora,
(forSQL*Netversion2),andredefinetheORACLE_SIDenvironment
variabletoanewvalue.
Forexample,searchthroughdisksanddoagrepORACLE_SID*
4.Changelocationstothe"dbs"directory
%cd$ORACLE_HOME/dbs
andrenamethefollowingfiles:
oinit<sid>.ora(orusepfiletopointtotheinitfile.)
ocontrolfile(s).Thisisoptionalifyoudonotrenameany
ofthecontrolfiles,andthecontrol_filesparameterisused.
The"control_files"parameterissetinthe"init<SID>.ora"file
orinafileitreferenceswiththeifileparameter.Make
surethatthecontrol_filesparameterdoesnotpointtoold
filenames,ifyouhaverenamedthem.
o"crdb<sid>.sql"&"crdb2<sid>.sql",Thisisoptional.Theseare
onlyusedatdatabasecreation.
5.Changelocationstothe"rdbms/admin"directory
%cd$ORACLE_HOME/rdbms/admin
andrenamethefile:
ostartup<sid>.sql.Thisisoptional.Onsomeplatforms,
thisfilemaybeinthe"$ORACLE_HOME/rdbms/install"directory.
Makesurethatthecontentsofthisfiledonotreferenceold
init<SID>.orafilesthathavebeenrenamed.Thisfile
simplifiesthe"startupexclusive"processtostartyourdatabase.
6.Torenamethedatabasefilesandredologfiles,youwouldfollowthe
instructionsin<Note:9560.1>.
7.ChangetheORACLE_SIDenvironmentvariabletothenewvalue.
8.Checkinthe"$ORACLE_HOME/dbs"directorytoseeifthepassword
filehasbeenenabled.Ifenabled,thefile"orapw<OLD_SID>"will
existandanewpasswordfileforthenewSIDmustbecreated
(renamingtheoldfilewillnotwork).If"orapw<OLD_SID>"doesnot
exist,skiptostep9.Tocreateanewpasswordfile,issue
thefollowingcommandasoracleowner:
orapwdfile=orapw<NEWSID>password=??entries=<numberofuserstobe
grantedpermissiontostartthedatabaseinstance>
9.Startupthedatabaseandverifythatitworks.Onceyouhavedone
this,shutdownthedatabaseandtakeafinalbackupofallcontrol,
redo,anddatafiles.
10.Whentheinstanceisstarted,thecontrolfileisupdatedwiththe
currentORACLE_SID.
Changingthe"db_name"foraDatabase:
======================================
1.LogintoServerManager
%svrmgrl
SVRMGR>connectinternal
2.Type
SVRMGR>altersystemswitchlogfile;
toforceacheckpoint.
3.Type
SVRMGR>alterdatabasebackupcontrolfiletotraceresetlogs;
Thiswillcreateatracefilecontainingthe"CREATECONTROLFILE"
commandtorecreatethecontrolfileinitscurrentform.
4.ShutdownthedatabaseandexitSVRMGR
SVRMGR>shutdown
SVRMGR>exit
ThedatabasemustbeshutdownwithSHUTDOWNNORMALorSHUTDOWNIMMEDIATE.
ItmustnotbeshutdownabnormallyusingSHUTDOWNABORT.
5.Changelocationstothedirectorywhereyourtracefilesarelocated.
Theyareusuallyinthe"$ORACLE_HOME/rdbms/log"directory.If
"user_dump_dest"issetinthe"init<SID>.ora"file,thengotothe
directorylistedinthe"user_dump_dest"variable.Thetracefilewill
havetheform"ora_NNNN.trcwithNNNNbeinganumber.
6.Getthe"CREATECONTROLFILE"commandfromthetracefileandputitina
newfilecalledsomethinglike"ccf.sql".
7.Editthe"ccf.sql"file
FROM:CREATECONTROLFILEREUSEDATABASE"olddbname"NORESETLOGS...
TO:CREATECONTROLFILEsetDATABASE"newdbname"RESETLOGS...
FROM:
#Recoveryisrequiredifanyofthedatafilesarerestoredbackups,
#orifthelastshutdownwasnotnormalorimmediate.
RECOVERDATABASEUSINGBACKUPCONTROLFILE
TO:
#Recoveryisrequiredifanyofthedatafilesarerestoredbackups,
#orifthelastshutdownwasnotnormalorimmediate.
#RECOVERDATABASEUSINGBACKUPCONTROLFILE
8.Saveandexitthe"ccf.sql"file
9.Renametheoldcontrolfilesforbackuppurposesandsothattheydo
notexistwhencreatingthenewones.
10.Editthe"init<SID>.ora"filesothatdb_name="newdb_name".
11.LogintoServerManager
%svrmgrl
SVRMGR>connectinternal
12.Runthe"ccf.sql"script
SVRMGR>@ccf
Thiswillissueastartupnomount,andthenrecreatethecontrolfile.
If,atthispoint,youreceivetheerrorthatafileneedsmediarecovery,
thedatabasewasnotshutdownnormallyasspecifiedinstep4.Youcan
tryrecoveringthedatabaseusingtheredointhecurrentlogfile,by
issuing:
SVRMGRL>recoverdatabaseusingbackupcontrolfile;
Thiswillpromptforanarchivedredologfile.Itmaybepossibleto
openthedatabaseafterapplyingthecurrentlogfile.BUTthisisnot
guaranteed.If,afterapplyingthecurrentlogfile,thedatabasewill
notopenthenitishighlylikelythattheoperationmustberestarted
havingshutdownthedatabasenormally.
Toapplythenecessaryredo,youneedtochecktheonlinelogfiles
andapplytheonewiththesamesequencenumberasreportedinthe
message.Thisusuallyisthelogfilewithstatus=CURRENT.
Tofindalistoftheonlinelogfiles:
SVRMGR>selectgroup#,seq#,statusfromv$log;
GROUP#SEQUENCE#STATUS
-----------------------------------
1123CURRENT<==thisredoneedstobeapplied
2124INACTIVE
3125INACTIVE
4126INACTIVE
5127INACTIVE
6128INACTIVE
7129INACTIVE
7rowsselected.
SVRMGR>selectmember
fromv$logfile
whereGROUP#=1;
Member
------------------------------------
/u02/oradata/V815/redoV81501.log
Thelastcommandinccf.sqlshouldbe:
SVRMGR>alterdatabaseopenresetlogs;
13.Youmayalsoneedtochangetheglobaldatabasename:
alterdatabaserenameglobal_nameto<newdb_name>.<domain>
See<Note:1018634.102>forfurtherdetail.
14.Makesurethedatabaseisworking.
15.Shutdownandbackupthedatabase.
@renamedatabasedb_nameoracle_sidsidchangename
@renamedatabasedb_nameoracle_sidsidchangename
@renamedatabasedb_nameoracle_sidsidchangename
@renamedatabasedb_nameoracle_sidsidchangename
@renamedatabasedb_nameoracle_sidsidchangename
@renamedatabasedb_nameoracle_sidsidchangename
@renamedatabaserenamedatabaserenamedatabaserenamedatabaserenamedatabase
yanqf 回复于:2003-04-24 12:33:04
太复杂了!
zorrol 回复于:2003-06-09 14:55:30
文章好用,更改实例名容易,主要以下,一般不会出问题.
1.Shutdowntheinstance
2.Backupallcontrol,redo,anddatafiles.
3.Gothroughthe.profile,.cshrc,.login,oratab,tnsnames.ora,
(forSQL*Netversion2),andredefinetheORACLE_SIDenvironment
variabletoanewvalue.
Forexample,searchthroughdisksanddoagrepORACLE_SID*
4.Changelocationstothe"dbs"directory
%cd$ORACLE_HOME/dbs
andrenamethefollowingfiles:
oinit<sid>.ora(orusepfiletopointtotheinitfile.)
ocontrolfile(s).Thisisoptionalifyoudonotrenameany
ofthecontrolfiles,andthecontrol_filesparameterisused.
The"control_files"parameterissetinthe"init<SID>.ora"file
orinafileitreferenceswiththeifileparameter.Make
surethatthecontrol_filesparameterdoesnotpointtoold
filenames,ifyouhaverenamedthem.
o"crdb<sid>.sql"&"crdb2<sid>.sql",Thisisoptional.Theseare
onlyusedatdatabasecreation.
5.Changelocationstothe"rdbms/admin"directory
%cd$ORACLE_HOME/rdbms/admin
andrenamethefile:
ostartup<sid>.sql.Thisisoptional.Onsomeplatforms,
thisfilemaybeinthe"$ORACLE_HOME/rdbms/install"directory.
Makesurethatthecontentsofthisfiledonotreferenceold
init<SID>.orafilesthathavebeenrenamed.Thisfile
simplifiesthe"startupexclusive"processtostartyourdatabase.
6.Torenamethedatabasefilesandredologfiles,youwouldfollowthe
instructionsin<Note:9560.1>.
7.ChangetheORACLE_SIDenvironmentvariabletothenewvalue.
8.Checkinthe"$ORACLE_HOME/dbs"directorytoseeifthepassword
filehasbeenenabled.Ifenabled,thefile"orapw<OLD_SID>"will
existandanewpasswordfileforthenewSIDmustbecreated
(renamingtheoldfilewillnotwork).If"orapw<OLD_SID>"doesnot
exist,skiptostep9.Tocreateanewpasswordfile,issue
thefollowingcommandasoracleowner:
orapwdfile=orapw<NEWSID>password=??entries=<numberofuserstobe
grantedpermissiontostartthedatabaseinstance>
9.Startupthedatabaseandverifythatitworks.Onceyouhavedone
this,shutdownthedatabaseandtakeafinalbackupofallcontrol,
redo,anddatafiles.
10.Whentheinstanceisstarted,thecontrolfileisupdatedwiththe
currentORACLE_SID.
psuo 回复于:2003-06-27 18:28:20
看了头晕!!不懂!
木言 回复于:2003-07-07 20:47:18
其实大家应该是要一种增加实例名的方法,我也想知道?
rollingpig 回复于:2003-07-08 09:27:42
[quote:ca100be8b5="木言"]其实大家应该是要一种增加实例名的方法,我也想知道?[/quote:ca100be8b5]
什么意思?
增加一个实例??
guohualing 回复于:2003-07-08 09:39:18
用DatabaseConfigurationAssistant可以增加实例,用NetConfigurationAssistant可以为一个实例配置不同的服务名
gototop 回复于:2003-07-12 20:37:49
[quote:c02c5761dc="老邱"]很麻烦。..........[/quote:c02c5761dc]
应该说很简单,也就那么几步而已,这里我写了一个tips:
http://www.ncn.cn/oracle/tips/oratip003.htm
txfy 回复于:2003-07-30 14:17:53
今天英文看多了,头晕眼花,直犯蒙,哎!
查看上一页
返回分类首页 返回96PC首页
查看下一页 |