`
wsql
  • 浏览: 11779262 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

12.10号---11G新特性管理 SPFILE 说明

 
阅读更多

在Oracle 11g 以前,我们可以从spfile来创建pfile,或者利用pfile来创建spfile。 在Oracle 11g中,在管理spfile方面得到增强,可以从memory来创建pfile和spfile。

语法如下:

CREATE PFILE [= 'pfile_name' ]

FROM { { SPFILE [= 'spfile_name'] } | MEMORY } ;

CREATE SPFILE [= 'spfile_name' ]

FROM { { PFILE [= 'pfile_name' ] } | MEMORY } ;

示例:

[15:43 oracle@dave /u01/backup]$ora si

SQL*Plus: Release 11.2.0.3.0 Production onFri Oct 12 15:43:22 2012

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

SQL> create pfile from memory;

File created.

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-32002: cannot createSPFILE already being used by the instance

--对于open 状态的实例,不能从memory创建spfile。

SQL> startup mount force;

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 285213040 bytes

Database Buffers 419430400 bytes

Redo Buffers 23838720 bytes

Database mounted.

SQL> select open_mode from v$database;

OPEN_MODE

--------------------

MOUNTED

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-32002: cannot createSPFILE already being used by the instance

--mount 状态也不可以使用

SQL> startup nomount force;

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 285213040 bytes

Database Buffers 419430400 bytes

Redo Buffers 23838720 bytes

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-32002: cannot createSPFILE already being used by the instance

--nomount 状态也不可以

SQL> shutdown abort;

ORACLE instance shut down.

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-00922: missing or invalid option

--数据库关闭后,语法不可以用。

我们用pfile启动数据库,在来创建spfile:

SQL> startuppfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initdave.ora'

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 285213040 bytes

Database Buffers 419430400 bytes

Redo Buffers 23838720 bytes

Database mounted.

Database opened.

SQL> create spfile from memory;

File created.

--这次创建成功。

注意:

(1)如果是RAC 环境,那么生成的脚本会包含所有节点的参数。

(2)执行这个命令需要使用sysdba或sysoper角色来执行。

在Oracle 11g 以前,我们可以从spfile来创建pfile,或者利用pfile来创建spfile。 在Oracle 11g中,在管理spfile方面得到增强,可以从memory来创建pfile和spfile。

语法如下:

CREATE PFILE [= 'pfile_name' ]

FROM { { SPFILE [= 'spfile_name'] } | MEMORY } ;

CREATE SPFILE [= 'spfile_name' ]

FROM { { PFILE [= 'pfile_name' ] } | MEMORY } ;

示例:

[15:43 oracle@dave /u01/backup]$ora si

SQL*Plus: Release 11.2.0.3.0 Production onFri Oct 12 15:43:22 2012

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

SQL> create pfile from memory;

File created.

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-32002: cannot createSPFILE already being used by the instance

--对于open 状态的实例,不能从memory创建spfile。

SQL> startup mount force;

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 285213040 bytes

Database Buffers 419430400 bytes

Redo Buffers 23838720 bytes

Database mounted.

SQL> select open_mode from v$database;

OPEN_MODE

--------------------

MOUNTED

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-32002: cannot createSPFILE already being used by the instance

--mount 状态也不可以使用

SQL> startup nomount force;

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 285213040 bytes

Database Buffers 419430400 bytes

Redo Buffers 23838720 bytes

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-32002: cannot createSPFILE already being used by the instance

--nomount 状态也不可以

SQL> shutdown abort;

ORACLE instance shut down.

SQL> create spfile from memory;

create spfile from memory

*

ERROR at line 1:

ORA-00922: missing or invalid option

--数据库关闭后,语法不可以用。

我们用pfile启动数据库,在来创建spfile:

SQL> startuppfile='/u01/app/oracle/product/11.2.0/db_1/dbs/initdave.ora'

ORACLE instance started.

Total System Global Area 730714112 bytes

Fixed Size 2231952 bytes

Variable Size 285213040 bytes

Database Buffers 419430400 bytes

Redo Buffers 23838720 bytes

Database mounted.

Database opened.

SQL> create spfile from memory;

File created.

--这次创建成功。

注意:

(1)如果是RAC 环境,那么生成的脚本会包含所有节点的参数。

(2)执行这个命令需要使用sysdba或sysoper角色来执行。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics