基于oracle restart的单实例SRVCTL使用详解

来源:互联网 发布:西门子plc200编程100例 编辑:程序博客网 时间:2024/06/06 06:38

srvctl语法:

srvctl command object options

command为动词,详细见下表

  

Command

   

Description

   

add

   

Adds a  component to the Oracle Restart configuration.

   

config

   

Displays  the Oracle Restart configuration for a component.

   

disable

   

Disables  management by Oracle Restart for a component.

   

enable

   

Reenables  management by Oracle Restart for a component.

   

getenv

   

Displays  environment variables in the Oracle Restart configuration for a database,  Oracle ASM instance, or listener.

   

modify

   

Modifies  the Oracle Restart configuration for a component.

   

remove

   

Removes  a component from the Oracle Restart configuration.

   

setenv

   

Sets  environment variables in the Oracle Restart configuration for a database,  Oracle ASM instance, or listener.

   

start

   

Starts  the specified component.

   

status

   

Displays  the running status of the specified component.

   

stop

   

Stops  the specified component.

   

unsetenv

   

Unsets  environment variables in the Oracle Restart configuration for a database,  Oracle ASM instance, or listener.

 

object为组件名,也可以使用简写(Abbreviation)详细见下表

  

Component

   

Abbreviation

   

Description

   

asm

   

asm

   

Oracle  ASM instance

   

database

   

db

   

Database  instance

   

diskgroup

   

dg

   

Oracle  ASM disk group

   

filesystem

   

filesystem

   

Oracle  ASM file system

   

home

   

home

   

Oracle  home or Oracle Clusterware home

   

listener

   

lsnr

   

Oracle  Net listener

   

service

   

serv

   

Database  service

   

ons

   

ons

   

Oracle  Notification Services (ONS)

 

option为前面command命令的扩展,

说明:参数后面跟多个对象时用逗号隔开,在windows平台下要加上双引号("...,...")

下面开始详细介绍(这里只举例子,详细参数参看srvctl command object -h)

  

add 增加组件到oracle restart配置中

 

srvctl add asm -l crmlistener

   

config   ----显示组件在oracle restart中配置

 

1.[oracle@asm1 ~]$ srvctl config asm

 

ASM home:  /u01/app/oracle/grid/11.2.0

 

ASM listener:  LISTENER

 

Spfile:  +DATA/asm/asmparameterfile/registry.253.822353243

 

ASM diskgroup  discovery string:

 

[oracle@asm1 ~]$  srvctl config asm -a

 

ASM home:  /u01/app/oracle/grid/11.2.0

 

ASM listener:  LISTENER

 

Spfile:  +DATA/asm/asmparameterfile/registry.253.822353243

 

ASM diskgroup  discovery string:

 

ASM is enabled.

 

2.[oracle@asm1 ~]$ srvctl config database

 

asm00

 

[oracle@asm1 ~]$  srvctl config database -d asm00

 

Database unique  name: asm00

 

Database name:  asm00

 

Oracle home:  /u01/app/oracle/product/11.2.0

 

Oracle user:  oracle

 

Spfile:  +DATA/asm00/spfileasm00.ora

 

Domain:

 

Start options:  open

 

Stop options:  immediate

 

Database role:  PRIMARY

 

Management policy:  AUTOMATIC

 

Disk Groups:  DATA,FRA

 

Services:

 

[oracle@asm1 ~]$  srvctl config database -d asm00 -a

 

Database unique  name: asm00

 

Database name:  asm00

 

Oracle home:  /u01/app/oracle/product/11.2.0

 

Oracle user:  oracle

 

Spfile:  +DATA/asm00/spfileasm00.ora

 

Domain:

 

Start options:  open

 

Stop options:  immediate

 

Database role:  PRIMARY

 

Management policy:  AUTOMATIC

 

Disk Groups:  DATA,FRA

 

Services:

 

Database is  enabled

 

3.[oracle@asm1 ~]$ srvctl config listener

 

Name: LISTENER

 

Home:  /u01/app/oracle/grid/11.2.0

 

End points:  TCP:1521

 

4.[oracle@asm1 ~]$ srvctl config ons

 

PRKO-2465 : ONS  does not exist.

 

5.[oracle@asm1 ~]$ srvctl config service -d asm00

 

 

   

disable   停止让oracle  restart管理,出现下面的情况需要使用disable

 

(1)不需要自动重启

 

(2)不希望被依赖的组件自动启动,例如:使用srvctl启动database的时候,asm实例,磁盘组等都会被自动启动,如果设置asm为disable状态则不能被依赖组件自动启动

 

(3)该组件不能使用srvctl启动

 

 

 

srvctl disable asm

 

srvctl disable database -d db_unique_name

 

srvctl disable diskgroup -g diskgroup_name
    srvctl disable listener [-l listener_name]

 

srvctl disable ons -v
    srvctl disable service -d db_unique_name  -s service_name_list

   

enable   使disable的组件重新可用

   

getenv   显示oracle  restart中asm,database,listener的环境变量

   

modify   修改组件在oracle  restart中的配置,下次restart生效

   

remove   从oracle  restart配置中删除组件

   

setenv   设置oracle  restart配置中asm,database,listener的环境变量

 

[oracle@asm1 ~]$  srvctl setenv database -d asm00 -t LANG=en,ORACLE_SID=asm00

 

[oracle@asm1 ~]$  srvctl getenv database -d asm00

 

asm00:

 

LANG=en

 

ORACLE_SID=asm00

 

 

   

start   启动单个或一组组件

 

Srvctl start home ----状态文件由srvctl status  home或者srvctl stop home生成

   

status 查看组件的状态

   

stop   停止组件不是disable组件,注意和disable区别

   

unsetenv   删除环境变量

 

[oracle@asm1 ~]$  srvctl unsetenv database -d asm00 -t LANG,ORACLE_SID

 

[oracle@asm1 ~]$  srvctl getenv database -d asm00

 

asm00:

 

 

   

 

 

 

参考:Oracle® DatabaseAdministrator's Guide 11g Release 2 (11.2)--->SRVCTLCommand Reference for Oracle Restart

原创粉丝点击