Sometimes, the SPFILE gets damaged. When this happens, the SPFILE can be replaced by a 有时候SPFILE会被破坏掉。当这种情况发生的时候,它可已被新的代替,这个新的SPFILE是通过PFILE生成的。PFILE是在数据库创建的时候被自动生成在ORACLE_HOME\admin\SID\pfile目录下的。
新的SPFILE可以这样被生成: - 以SYSDBA的身份连接数据库实例 - 利用下面的命令创建新的SPFILE: SQL> CREATE SPFILE FROM PFILE = 'ORACLE_HOME\admin\SID\pfile \my_pfile.ora'; //具我实验的这个才是对的: create spfile from pfile = '/orasys/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora' 这个命令将把SPFILE创建在默认的目录下。如果目录下SPFILE已存在则将被覆盖。 或者可以用下面的命令将SPFILE创建到指定目录下: SQL> CREATE SPFILE = 'desired_directory\my_spfile.ora' FROM PFILE = 'ORACLE_HOME\admin\SID\pfile\my_pfile.ora'; 用上免得命令非默认的SPFILE将被创建。并且名字必须与现在实例运行用得SPFILE的名字不同。 要想覆盖旧的SPFILE,只需要把旧的从ORACLE_HOME\ora92\database\目录下删除,然后将新的SPFILE拷到这里并重名跟以前的一样。最后启动实例,新的SPFILE将被使用。 new one, generated from the PFILE file. The PFILE file is made automatically when the database is created and it can be found in the folder ORACLE_HOME\admin\SID\pfile. The new SPFILE can be generated as follows: - connect with sqlplus to the instance as sysdba - use one of the following commands: SQL> CREATE SPFILE FROM PFILE = 'ORACLE_HOME\admin\SID\pfile \my_pfile.ora'; Using this command Oracle will assume you are creating a default SPFILE. If a default SPFILE already exists Oracle will overwrite it. Or you can use
SQL> CREATE SPFILE = 'desired_directory\my_spfile.ora' FROM PFILE = 'ORACLE_HOME\admin\SID\pfile\my_pfile.ora'; Using this, a non-default SPFILE will be created. The name of the new SPFILE must not be the same as the SPFILE that was used to start the current instance. For replacing the old SPFILE just delete the old one from ORACLE_HOME\ ora92\database\directory, copy here the new one and rename it with the name of the original SPFILE. After that you can start the instance and it will start with the parameters from the new SPFILE. 附常用sql命令: sqlplus /nolog 监听的打开./lsnrctl start sqlplus /nolog conn / as sysdba startup