MSSQL网页编程之Use Nid to Change dbname
php本地模拟的prepare底层就是mysql_real_escape_string,所以必须得用mysql_set_character_set去设置mysql->charset,否则就存在字符集问题。link:
http://www.eygle.com/faq/Use.Nid.to.Change.Your.dbname.htm
Nid是Oracle从9iR2入手下手供应的工具,能够用来变动数据库称号,而无需经由过程之前重修把持文件等烦琐体例.
必要申明的是,固然这个工具来自9iR2,可是仍旧能够被用于Oracle8i.
先看一下匡助:
C:>nid-helpDBNEWID:Release10.1.0.2.0-ProductionCopyright(c)2001,2004,Oracle.Allrightsreserved.关头字申明(默许值)----------------------------------------------------TARGET用户名/口令(无)DBNAME新的数据库名(无)LOGFILE输入日记(无)REVERT复原失利的变动否SETNAME仅设置新的数据库名否APPEND附加至输入日记否HELP显现这些动静否
我们经由过程典范来看一下用法:
1.数据库以后设置
SQL>select*fromv$version;BANNER----------------------------------------------------------------Oracle9iEnterpriseEditionRelease9.2.0.1.0-ProductionPL/SQLRelease9.2.0.1.0-ProductionCORE9.2.0.1.0ProductionTNSfor32-bitWindows:Version9.2.0.1.0-ProductionNLSRTLVersion9.2.0.1.0-ProductionSQL>showparameternameNAMETYPEVALUE-----------------------------------------------------------------------------db_file_name_convertstringdb_namestringeyglevglobal_namesbooleanFALSEinstance_namestringeyglevlock_name_spacestringlog_file_name_convertstringoracle_trace_collection_namestringoracle_trace_facility_namestringoracledplsql_native_make_file_namestringservice_namesstringeyglev
2.Shutdown数据库
SQL>connectsys/orasysassysdbaConnected.SQL>shutdownimmediateDatabaseclosed.Databasedismounted.ORACLEinstanceshutdown.
3.Startupmount
SQL>startupmount
ORACLEinstancestarted.
TotalSystemGlobalArea135338868bytes
FixedSize453492bytes
VariableSize109051904bytes
DatabaseBuffers25165824bytes
RedoBuffers667648bytes
Databasemounted.
4.利用NID变动
SQL>hostMicrosoftWindows2000(C)版权一切1985-2000MicrosoftCorp.C:>nidtarget=sys/orasysdbname=eyglenDBNEWID:Release9.2.0.1.0-ProductionCopyright(c)1995,2002,OracleCorporation.Allrightsreserved.ConnectedtodatabaseEYGLEV(DBID=677189177)ControlFilesindatabase:E:ORACLEORADATAEYGLENCONTROL01.CTLE:ORACLEORADATAEYGLENCONTROL02.CTLE:ORACLEORADATAEYGLENCONTROL03.CTLChangedatabaseIDanddatabasenameEYGLEVtoEYGLEN?(Y/)=>YProceedingwithoperationChangingdatabaseIDfrom677189177to3955758099ChangingdatabasenamefromEYGLEVtoEYGLENControlFileE:ORACLEORADATAEYGLENCONTROL01.CTL-modifiedControlFileE:ORACLEORADATAEYGLENCONTROL02.CTL-modifiedControlFileE:ORACLEORADATAEYGLENCONTROL03.CTL-modifiedDatafileE:ORACLEORADATAEYGLENYSTEM01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENUNDOTBS01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENCWMLITE01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENDRSYS01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENINDX01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENODM01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENTOOLS01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENUSERS01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENXDB01.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENEYGLE.DBF-dbidchanged,wrotenewnameDatafileE:ORACLEORADATAEYGLENTEMP01.DBF-dbidchanged,wrotenewnameControlFileE:ORACLEORADATAEYGLENCONTROL01.CTL-dbidchanged,wrotenewnameControlFileE:ORACLEORADATAEYGLENCONTROL02.CTL-dbidchanged,wrotenewnameControlFileE:ORACLEORADATAEYGLENCONTROL03.CTL-dbidchanged,wrotenewnameDatabasenamechangedtoEYGLEN.Modifyparameterfileandgenerateanewpasswordfilebeforerestarting.DatabaseIDfordatabaseEYGLENchangedto3955758099.Allpreviousbackupsandarchivedredologsforthisdatabaseareunusable.ShutdowndatabaseandopenwithRESETLOGSoption.SuccesfullychangeddatabasenameandID.DBNEWID-Completedsuccesfully.
5.Shutdowndatabase
SQL>shutdownimmediate
ORA-01109:databasenotopen
Databasedismounted.
ORACLEinstanceshutdown.
6.修正初始化参数文件、spfile文件(init.ora/spfile)
###########################################
instance_name=eyglen
#instance_name=eyglev
###########################################
db_domain=""
db_name=eyglen
#db_name=eyglev
###########################################
7.重修spfile文件
假如你没有利用spfile,固然无需重修,跳至8
SQL>startuppfile=E:Oracleadmineyglenpfileinit.oraORACLEinstancestarted.TotalSystemGlobalArea135338868bytesFixedSize453492bytesVariableSize109051904bytesDatabaseBuffers25165824bytesRedoBuffers667648bytesORA-01991:invalidpasswordfilee:oracleOra9iR2DATABASEPWDeyglen.ORASQL>CREATESPFILE=E:OracleOra9iR2databasePFILEEYGLEN.ORAFROM2PFILE=E:Oracleadmineyglenpfileinit.ora;Filecreated.
8.重修口令文件
SQL>host
MicrosoftWindows2000
(C)版权一切1985-2000MicrosoftCorp.
C:>orapwdfile=E:OracleOra9iR2databasePWDeyglen.ORApassword=oracleentries=5
9.shutdown数据库
假如不利用spfile,则能够跳至10
SQL>shutdownimmediate
ORA-01109:databasenotopen
Databasedismounted.
ORACLEinstanceshutdown.
10.Startupmount,resetlogs翻开
SQL>startupmountORACLEinstancestarted.TotalSystemGlobalArea135338868bytesFixedSize453492bytesVariableSize109051904bytesDatabaseBuffers25165824bytesRedoBuffers667648bytesDatabasemounted.SQL>alterdatabaseopenresetlogs2/Databasealtered.SQL>
11.修正后的参数
SQL>showparameternameNAMETYPEVALUE-----------------------------------------------------------------------------db_file_name_convertstringdb_namestringeyglenglobal_namesbooleanFALSEinstance_namestringeyglenlock_name_spacestringlog_file_name_convertstringoracle_trace_collection_namestringoracle_trace_facility_namestringoracledplsql_native_make_file_namestringservice_namesstringeyglen
12.对数据库做个全备份
附:利用nid变动817的数据库
1.变动前
SVRMGR>startupmount已启动ORACLE实例。体系全局地区算计有61970460个字节FixedSize75804个字节VariableSize17645568个字节DatabaseBuffers44171264个字节RedoBuffers77824个字节已装进数据库。SVRMGR>showparameternameNAMETYPEVALUE------------------------------------------------------------------------db_file_name_convert字符串db_name字符串vilenglobal_names布尔值TRUEinstance_name字符串vilenlock_name_space字符串log_file_name_convert字符串oracle_trace_collection_name字符串oracle_trace_facility_name字符串oracledservice_names字符串vilenSVRMGR>
2.修正
C:>nidtarget=sys/orasys@vilendbname=vileneDBNEWID:Release9.2.0.1.0-ProductionCopyright(c)1995,2002,OracleCorporation.Allrightsreserved.ConnectedtodatabaseVILEN(DBID=1535443189)ControlFilesindatabase:C:ORACLEORADATAVILENCONTROL01.CTLC:ORACLEORADATAVILENCONTROL02.CTLC:ORACLEORADATAVILENCONTROL03.CTLChangedatabaseIDanddatabasenameVILENtoVILENE?(Y/)=>YProceedingwithoperationChangingdatabaseIDfrom1535443189to681857412ChangingdatabasenamefromVILENtoVILENEControlFileC:ORACLEORADATAVILENCONTROL01.CTL-modifiedControlFileC:ORACLEORADATAVILENCONTROL02.CTL-modifiedControlFileC:ORACLEORADATAVILENCONTROL03.CTL-modifiedDatafileC:ORACLEORADATAVILENYSTEM01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENRBS01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENUSERS01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENTEMP01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENTOOLS01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENINDX01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENEQSP01.DBF-dbidchanged,wrotenewnameDatafileC:ORACLEORADATAVILENPERFSTAT.DBF-dbidchanged,wrotenewnameControlFileC:ORACLEORADATAVILENCONTROL01.CTL-dbidchanged,wrotenewnameControlFileC:ORACLEORADATAVILENCONTROL02.CTL-dbidchanged,wrotenewnameControlFileC:ORACLEORADATAVILENCONTROL03.CTL-dbidchanged,wrotenewnameDatabasenamechangedtoVILENE.Modifyparameterfileandgenerateanewpasswordfilebeforerestarting.DatabaseIDfordatabaseVILENEchangedto681857412.Allpreviousbackupsandarchivedredologsforthisdatabaseareunusable.ShutdowndatabaseandopenwithRESETLOGSoption.SuccesfullychangeddatabasenameandID.DBNEWID-Completedsuccesfully.
3.封闭数据库
SVRMGR>shutdownimmediate
ORA-01109:数据库未翻开
已卸下数据库。
已封闭ORACLE实例。
4.修正参数文件
db_name="vilene"
#db_name="vilen"
instance_name=vilene
#instance_name=vilen
5.重修口令文件
C:oracledatabase>orapwdfile=PWDvilen.ORApassword=oracleentries=5
C:oracledatabase>
6.mount数据库
SVRMGR>startupmountORACLEinstancestarted.TotalSystemGlobalArea61970460bytesFixedSize75804bytesVariableSize17645568bytesDatabaseBuffers44171264bytesRedoBuffers77824bytesDatabasemounted.
7.翻开数据库
SVRMGR>alterdatabaseopenresetlogs
2>/
Statementprocessed.
8.修正后的参数
SVRMGR>showparameternameNAMETYPEVALUE------------------------------------------------------------------------db_file_name_convertstringdb_namestringvileneglobal_namesbooleanTRUEinstance_namestringvilenelock_name_spacestringlog_file_name_convertstringoracle_trace_collection_namestringoracle_trace_facility_namestringoracledservice_namesstringvilen
Archive非常适合存储大量的独立的,作为历史记录的数据。因为它们不经常被读取。Archive拥有高效的插入速度,但其对查询的支持相对较差 你觉得我的非分区索引无法对起子分区,你可以提醒我一下呀!没有任何的提醒,直接就变成了非分区表。不知道这算不算一个bug。大家也可以试试。 需要注意的一点,也是我使用过程中发现的一个问题。在建立function->schema->table后,如果在现有的分区表上建立没有显式声明的聚集索引时,分区表会自动变为非分区表。这一点很让我纳闷。 总感觉自己还是不会SQL 连做梦都在想页面结构是怎么样的,绝非虚言 呵呵,这就是偶想说的 一直以来个人感觉SQLServer的优化器要比Oracle的聪明。SQL2005的更是比2k聪明了不少。(有次作试验发现有的语句在200万级时还比50万级的相同语句要快show_text的一些提示没有找到解释。一直在奇怪。) 不过话说回来了,绝大多数的性能优化准则与对sqlserver存储的结构理解息息相关
页:
[1]