分类目录归档:Oracle ASM

远程访问ASM

一、动态监听
1.监听文件

[oracle@node1 admin]$ more /u01/oracle/network/admin/listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/oracle)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

2.监听状态

[oracle@node1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2012 13:38:42

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                18-JAN-2012 13:32:49
Uptime                    0 days 0 hr. 5 min. 53 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/network/admin/listener.ora
Listener Log File         /u01/oracle/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "chf" has 1 instance(s).
  Instance "chf", status READY, has 1 handler(s) for this service...
Service "chfXDB" has 1 instance(s).
  Instance "chf", status READY, has 1 handler(s) for this service...
Service "chf_XPT" has 1 instance(s).
  Instance "chf", status READY, has 1 handler(s) for this service...
The command completed successfully

3.客户端tns文件[有部分测试加上了(UR=A)]

vm_asm =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = +ASM)
      (INSTANCE_NAME = +ASM)
      (UR=A)  #分存在和不存在测试
    )
  )

vm_chf =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = chf)
      (INSTANCE_NAME = chf)
    )
  )

4.无测试(UR=A)

C:\Users\XIFENFEI>tnsping vm_asm

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -
2012 22:15:10

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

已使用的参数文件:
e:\oracle\11_2_0\network\admin\sqlnet.ora


已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =
1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM)))
OK (10 毫秒)

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:15:14 2012

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

ERROR:
ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务


请输入用户名:
ERROR:
ORA-12560: TNS: 协议适配器错误


请输入用户名:
ERROR:
ORA-12560: TNS: 协议适配器错误


SP2-0157: 在 3 次尝试之后无法连接到 ORACLE, 退出 SQL*Plus

--通过下面的数据库实例测试,证明动态监听是正常工作的,可以访问数据库
C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_chf as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 21:55:03 2012

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
chf

5.含(UR=A)测试

C:\Users\XIFENFEI>tnsping vm_asm

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -
2012 22:16:49

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

已使用的参数文件:
e:\oracle\11_2_0\network\admin\sqlnet.ora


已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =
1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A)))
OK (20 毫秒)

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:16:52 2012

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
--------------------------------
+ASM

二、静态监听
1.监听文件

[oracle@node1 admin]$ more listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =  
     (GLOBAL_DBNAME = chf)
     (ORACLE_HOME = /u01/oracle)
     (SID_NAME = chf)
    )
    (SID_DESC =
     (GLOBAL_DBNAME = +ASM)
     (ORACLE_HOME = /u01/oracle)
     (SID_NAME = +ASM)
     )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521))
    )
  )

2.监听状态

[oracle@node1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2012 13:53:52

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.30)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date                18-JAN-2012 13:51:48
Uptime                    0 days 0 hr. 2 min. 4 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/network/admin/listener.ora
Listener Log File         /u01/oracle/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.30)(PORT=1521)))
Services Summary...
Service "+ASM" has 2 instance(s).
  Instance "+ASM", status UNKNOWN, has 1 handler(s) for this service...
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "chf" has 2 instance(s).
  Instance "chf", status UNKNOWN, has 1 handler(s) for this service...
  Instance "chf", status READY, has 1 handler(s) for this service...
Service "chfXDB" has 1 instance(s).
  Instance "chf", status READY, has 1 handler(s) for this service...
Service "chf_XPT" has 1 instance(s).
  Instance "chf", status READY, has 1 handler(s) for this service...
The command completed successfully

3.无(UR=A)测试

C:\Users\XIFENFEI>tnsping vm_asm

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -
2012 22:11:34

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

已使用的参数文件:
e:\oracle\11_2_0\network\admin\sqlnet.ora


已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =
1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM)))
OK (20 毫秒)

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:11:06 2012

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
--------------------------------
+ASM

4.含(UR=A)测试

C:\Users\XIFENFEI>tnsping vm_asm

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -
2012 22:12:49

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

已使用的参数文件:
e:\oracle\11_2_0\network\admin\sqlnet.ora


已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =
1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A)))
OK (10 毫秒)

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:12:53 2012

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
--------------------------------
+ASM

5.easy connect访问asm实例

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@192.168.1.30/+asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:27:42 2012

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


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
--------------------------------
+ASM

三、总结
1.在动态监听中,只有设置了(UR=A)才能够远程访问ASM实例;
2.在静态监听中,无论是否设置(UR=A)均可远程访问ASM实例,甚至可以使用easy connect方法方法ASM实例。

发表在 Oracle ASM | 一条评论

ASM迁移至文件系统

--创建pfile文件
SQL> create  pfile ='/tmp/pfile' from spfile;

File created.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

--修改pfile中关于asm中的内容
control_files
db_recovery_file_dest
log_archive_dest_1
指定到文件系统

--登录rman
[oracle@localhost tmp]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Jun 27 12:48:26 2011

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

connected to target database: TOS (DBID=1569606545)

--执行backup as copy datafile
RMAN>  backup as copy  datafile '+DATA/tos/datafile/users.276.754906035' format '/u01/oradata/tos/USERS01.dbf';

Starting backup at 27-JUN-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=+DATA/tos/datafile/users.276.754906035
output filename=/u01/oradata/tos/USERS01.dbf tag=TAG20110627T124853 recid=17 stamp=754922939
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 27-JUN-11

RMAN>  backup as copy  datafile '+DATA/tos/datafile/sysaux.271.754905929' format '/u01/oradata/tos/SYSAUX01.dbf';

Starting backup at 27-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=+DATA/tos/datafile/sysaux.271.754905929
output filename=/u01/oradata/tos/SYSAUX01.dbf tag=TAG20110627T124929 recid=18 stamp=754923029
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:05
Finished backup at 27-JUN-11

RMAN>  backup as copy  datafile '+DATA/tos/datafile/undotbs1.273.754906021' format '/u01/oradata/tos/UNDOTBS101.dbf';

Starting backup at 27-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=+DATA/tos/datafile/undotbs1.273.754906021
output filename=/u01/oradata/tos/UNDOTBS101.dbf tag=TAG20110627T125049 recid=19 stamp=754923057
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 27-JUN-11

RMAN>  backup as copy  datafile '+DATA/tos/datafile/system.270.754905833' format '/u01/oradata/tos/SYSTEM01.dbf';

Starting backup at 27-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=+DATA/tos/datafile/system.270.754905833
output filename=/u01/oradata/tos/SYSTEM01.dbf tag=TAG20110627T125112 recid=20 stamp=754923150
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting datafile copy
copying current control file
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/27/2011 12:52:39
ORA-01580: error creating control backup file /u01/oradata/tos/SYSTEM01.dbf
ORA-27038: created file already exists
Additional information: 1
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 27-JUN-11
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/27/2011 12:52:42
ORA-19504: failed to create file "/u01/oradata/tos/SYSTEM01.dbf"
ORA-27038: created file already exists
Additional information: 1
注:因为默认情况下,备份system数据文件是,会自动备份控制文件,这里因为system01.dbf已经备份好,而控制文件再次备份为该名称所以失败

RMAN>  backup as copy  datafile '+DATA/tos/datafile/example.272.754905995' format '/u01/oradata/tos/EXAMPLE01.dbf';

Starting backup at 27-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=+DATA/tos/datafile/example.272.754905995
output filename=/u01/oradata/tos/EXAMPLE01.dbf tag=TAG20110627T125341 recid=21 stamp=754923244
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 27-JUN-11

RMAN>  backup as copy  datafile '+DATA/tos/datafile/xff.274.754906027' format '/u01/oradata/tos/XFF01.dbf';

Starting backup at 27-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00006 name=+DATA/tos/datafile/xff.274.754906027
output filename=/u01/oradata/tos/XFF01.dbf tag=TAG20110627T125415 recid=22 stamp=754923257
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 27-JUN-11

RMAN>  backup as copy  datafile '+DATA/tos/datafile/xff.275.754906031' format '/u01/oradata/tos/XFF02.dbf';

Starting backup at 27-JUN-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00007 name=+DATA/tos/datafile/xff.275.754906031
output filename=/u01/oradata/tos/XFF02.dbf tag=TAG20110627T125507 recid=23 stamp=754923309
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04
Finished backup at 27-JUN-11

RMAN> exit

Recovery Manager complete.

--登录sqlplus
[oracle@localhost tmp]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 27 12:55:29 2011

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

--备份控制文件
SQL> alter database backup controlfile to '/tmp/control.ctl';

Database altered.

--关闭数据库
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

--启动数据库只nomount状态
SQL> startup pfile='/tmp/pfile' nomount;
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1260672 bytes
Variable Size              79692672 bytes
Database Buffers           79691776 bytes
Redo Buffers                7127040 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

[oracle@localhost tmp]$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Jun 27 12:58:22 2011

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

connected to target database: tos (not mounted)

--恢复控制文件
RMAN> restore controlfile from '/tmp/control.ctl';

Starting restore at 27-JUN-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: copied control file copy
output filename=/u01/oradata/tos/control01.ctl
output filename=/u01/oradata/tos/control02.ctl
Finished restore at 27-JUN-11

--启动数据库只mount状态
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

--修改数据文件在控制文件中位置
RMAN> switch tablespace SYSTEM to copy;

Starting implicit crosscheck backup at 27-JUN-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Finished implicit crosscheck backup at 27-JUN-11

Starting implicit crosscheck copy at 27-JUN-11
using channel ORA_DISK_1
Crosschecked 15 objects
Finished implicit crosscheck copy at 27-JUN-11

searching for all files in the recovery area
cataloging files...
no files cataloged

datafile 1 switched to datafile copy "/u01/oradata/tos/SYSTEM01.dbf"

RMAN> switch tablespace UNDOTBS1 to copy;

datafile 2 switched to datafile copy "/u01/oradata/tos/UNDOTBS101.dbf"

RMAN>  switch tablespace SYSAUX to copy;

datafile 3 switched to datafile copy "/u01/oradata/tos/SYSAUX01.dbf"

RMAN> switch tablespace USERS to copy;

datafile 4 switched to datafile copy "/u01/oradata/tos/USERS01.dbf"


RMAN>  switch tablespace EXAMPLE to copy;

datafile 5 switched to datafile copy "/u01/oradata/tos/EXAMPLE01.dbf"

RMAN>  switch tablespace XFF to copy;

datafile 6 switched to datafile copy "/u01/oradata/tos/XFF01.dbf"
datafile 7 switched to datafile copy "/u01/oradata/tos/XFF02.dbf"

--恢复数据库
RMAN> recover database;

Starting recover at 27-JUN-11
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 9 is already on disk as file +DATA/tos/onlinelog/group_6.279.754906321
archive log filename=+DATA/tos/onlinelog/group_6.279.754906321 thread=1 sequence=9
media recovery complete, elapsed time: 00:00:03
Finished recover at 27-JUN-11

--打开数据库
RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 06/27/2011 13:00:36
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;

database opened
注:不能直接使用open打开

RMAN> exit


Recovery Manager complete.

[oracle@localhost tmp]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Jun 27 13:02:53 2011

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

--增加redo log
SQL> alter database add logfile group 1 '/u01/oradata/tos/redo01.log' size 10m;

Database altered.

SQL> alter database add logfile group 2 '/u01/oradata/tos/redo02.log' size 10m;

Database altered.

SQL> alter database add logfile group 3 '/u01/oradata/tos/redo03.log' size 10m;

Database altered.

--切换日志
SQL>  alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> /

System altered.

--内存中数据写入硬盘
SQL> alter system checkpoint;

System altered.

--查询当前日志组状态
SQL>  select group#,status from v$log;

    GROUP# STATUS
---------- ----------------
         1 CURRENT
         2 INACTIVE
         3 INACTIVE
         4 INACTIVE
         5 INACTIVE
         6 INACTIVE

6 rows selected.

--删除asm中日志
SQL> alter database drop logfile group 4;

Database altered.

SQL> alter database drop logfile group 5;

Database altered.

SQL> alter database drop logfile group 6;

Database altered.

--添加临时文件
SQL> alter tablespace temp add tempfile '/u01/oradata/tos/temp01.dbf' size 30m autoextend on maxsize 1g;

Tablespace altered.

--查看临时表空间中临时文件
SQL> select name from v$tempfile;

NAME
--------------------------------------------------------------------------------
/u01/oradata/tos/temp01.dbf
+DATA/tos/tempfile/temp.280.754906369

--删除asm中临时文件
SQL> alter tablespace temp drop tempfile '+DATA/tos/tempfile/temp.280.754906369';

Tablespace altered.

--查看迁移结果
SQL> set pagesize 100
SQL> select name from v$datafile
  2   union
  3   select member from v$logfile
  4   union
  5   select name from v$controlfile
  6   union
  7   select name from v$tempfile;

NAME
------------------------------------------------------------------
/u01/oradata/tos/EXAMPLE01.dbf
/u01/oradata/tos/SYSAUX01.dbf
/u01/oradata/tos/SYSTEM01.dbf
/u01/oradata/tos/UNDOTBS101.dbf
/u01/oradata/tos/USERS01.dbf
/u01/oradata/tos/XFF01.dbf
/u01/oradata/tos/XFF02.dbf
/u01/oradata/tos/control01.ctl
/u01/oradata/tos/control02.ctl
/u01/oradata/tos/redo01.log
/u01/oradata/tos/redo02.log
/u01/oradata/tos/redo03.log
/u01/oradata/tos/temp01.dbf

13 rows selected.

--创建spfile文件
SQL> create spfile from pfile='/tmp/pfile';

File created.
发表在 Oracle ASM | 2 条评论

create spfile to asm

--查看sid
SQL> show parameter instance_name  ;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      tos

--创建pfile
SQL> create pfile='/tmp/tospfile' from spfile;

File created.

--创建spfile in asm
SQL> create spfile='+data' from pfile='/tmp/tospfile';

File created.

--查看spfile name in asm
ASMCMD> pwd
+data/tos/parameterfile
ASMCMD> ls
spfile.282.754913039

--编辑pfile内容(如果有该文件,先删除/重命名)
[oracle@localhost ~]$ vi  $ORACLE_HOME/dbs/inittos.ora
#内容为
spfile='+data/tos/parameterfile/spfile.282.754913039'

--重命名spfile文件
[oracle@localhost dbs]$ mv spfiletos.ora spfiletos.ora_bak

--重启数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1260672 bytes
Variable Size              75498368 bytes
Database Buffers           83886080 bytes
Redo Buffers                7127040 bytes
Database mounted.
Database opened.

--查看spfile
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/tos/parameterfile/spfile
                                                 .282.754913039
发表在 Oracle ASM | 评论关闭