Bo's Oracle Station

查看: 1460|回复: 0

2014-06-29-asm2.sql

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2014-6-29 21:08:46 | 显示全部楼层 |阅读模式
[root@station90 ~]# df -h
文件系统          容量  已用  可用 已用%% 挂载点
/dev/sda5              42G   37G  3.0G  93% /
tmpfs                 7.9G  6.5G  1.5G  82% /dev/shm
/dev/mapper/vol0-pub   40G  8.9G   29G  24% /var/ftp/pub
/dev/mmcblk0p1        1.9G     0  1.9G   0% /media/9A04-45FF
[root@station90 ~]# raw -qa
/dev/raw/raw7:    bound to major 8, minor 7
/dev/raw/raw8:    bound to major 8, minor 8
/dev/raw/raw9:    bound to major 8, minor 9
/dev/raw/raw10:    bound to major 8, minor 10
/dev/raw/raw11:    bound to major 8, minor 11
/dev/raw/raw12:    bound to major 8, minor 12
/dev/raw/raw13:    bound to major 8, minor 13
/dev/raw/raw14:    bound to major 8, minor 14
/dev/raw/raw15:    bound to major 8, minor 15
/dev/raw/raw20:    bound to major 7, minor 5
/dev/raw/raw21:    bound to major 7, minor 6
/dev/raw/raw22:    bound to major 7, minor 7
/dev/raw/raw23:    bound to major 7, minor 4
[root@station90 ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    station90   
ora.FRA.dg     ora....up.type ONLINE    ONLINE    station90   
ora....ER.lsnr ora....er.type ONLINE    ONLINE    station90   
ora.MYGROUP.dg ora....up.type ONLINE    ONLINE    station90   
ora.asm        ora.asm.type   ONLINE    ONLINE    station90   
ora.cssd       ora.cssd.type  ONLINE    ONLINE    station90   
ora.diskmon    ora....on.type ONLINE    ONLINE    station90   
ora.orcl.db    ora....se.type ONLINE    ONLINE    station90   
[root@station90 ~]# su  - oracle
[oracle@station90 ~]$ cd $TNS_ADMIN
[oracle@station90 admin]$ ls
listener.ora  listener.ora.bak.station90  samples  shrept.lst  sqlnet.ora
[oracle@station90 admin]$ pwd
/u01/app/oracle/product/11.2.0/grid/network/admin
[oracle@station90 admin]$ cd /u01/app/oracle/product/11.2.0/grid/network/admin
[oracle@station90 admin]$ ls
listener.ora  listener.ora.bak.station90  samples  shrept.lst  sqlnet.ora
[oracle@station90 admin]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin
[oracle@station90 admin]$ ls
listener.ora  samples  shrept.lst  tnsnames.ora
[oracle@station90 admin]$ vim tnsnames.ora
[oracle@station90 admin]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
[oracle@station90 admin]$ ls
listener.ora  samples  shrept.lst  tnsnames.ora
[oracle@station90 admin]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
[oracle@station90 admin]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin
[oracle@station90 admin]$ ls
listener.ora  samples  shrept.lst  tnsnames.ora
[oracle@station90 admin]$ vim listener.ora
[oracle@station90 admin]$ vim tnsnames.ora  
[oracle@station90 admin]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 29-JUN-2014 10:14:39

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=station90.example.com)(PORT=1521)))
The command completed successfully
[oracle@station90 admin]$ netstat -lntp | grep :1521
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
[oracle@station90 admin]$ srvctl add
用法: srvctl <command> <object> [<options>]
    命令: enable|disable|start|stop|status|add|remove|modify|getenv|setenv|unsetenv|config
    对象: database|service|asm|diskgroup|listener|home|ons|eons
有关各个命令和对象的详细帮助, 请使用:
  srvctl <command> -h 或
  srvctl <command> <object> -h
[oracle@station90 admin]$ srvctl add listener  -h

添加要由 Oracle Restart 管理的监听程序配置。

用法: srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>]
    -l <lsnr_name>           监听程序名称 (默认名称为 LISTENER)
    -o <oracle_home>         ORACLE_HOME 路径 (默认值为 CRS_HOME)
    -s                       跳过端口检查
    -p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"       逗号分隔的 TCP 端口或监听程序端点
    -h                       输出用法
[oracle@station90 admin]$ srvctl add listener  -o  /u01/app/oracle/product/11.2.0/dbhome_1
\[oracle@station90 admin]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://station90.example.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 11g Database Control .... started.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/log
[oracle@station90 admin]$ exit
logout
[root@station90 ~]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    station90   
ora.FRA.dg     ora....up.type ONLINE    ONLINE    station90   
ora....ER.lsnr ora....er.type ONLINE    ONLINE    station90   
ora.MYGROUP.dg ora....up.type ONLINE    ONLINE    station90   
ora.asm        ora.asm.type   ONLINE    ONLINE    station90   
ora.cssd       ora.cssd.type  ONLINE    ONLINE    station90   
ora.diskmon    ora....on.type ONLINE    ONLINE    station90   
ora.orcl.db    ora....se.type ONLINE    ONLINE    station90   
[root@station90 ~]# su - oracle
[oracle@station90 ~]$ srvc
srvconfig  srvctl     
[oracle@station90 ~]$ srvc
srvconfig  srvctl     
[oracle@station90 ~]$ srvctl   add  listener -h

添加要由 Oracle Restart 管理的监听程序配置。

用法: srvctl add listener [-l <lsnr_name>] [-s] [-p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"] [-o <oracle_home>]
    -l <lsnr_name>           监听程序名称 (默认名称为 LISTENER)
    -o <oracle_home>         ORACLE_HOME 路径 (默认值为 CRS_HOME)
    -s                       跳过端口检查
    -p "[TCP:]<port>[, ...][/IPC:<key>][/NMP:<pipe_name>][/TCPS:<s_port>] [/SDP:<port>]"       逗号分隔的 TCP 端口或监听程序端点
    -h                       输出用法
[oracle@station90 ~]$ srvctl   add  listener -o /u01/app/oracle/
admin/                 checkpoints/           directories/           man_recovery_area.11g/ product/               wallet/
botangdir01/           copy.sh                flash_recovery_area/   oradata/               rever.sh               
cfgtoollogs/           diag/                  man_recovery_area/     oraInventory/          sqlnet.log            
[oracle@station90 ~]$ srvctl   add  listener -o /u01/app/oracle/product/11.2.0/grid
[oracle@station90 ~]$ emca -deconfig dbcontrol db -repos drop -silent -PORT 1521 -SID orcl -SYS_PWD oracle_4U -DBSNMP_PWD oracle_4U -SYSMAN_PWD oracle_4U

EMCA 开始于 2014-6-29 10:26:57
EM Configuration Assistant, 11.2.0.0.2 正式版
版权所有 (c) 2003, 2005, Oracle。保留所有权利。


2014-6-29 10:27:00 oracle.sysman.emcp.EMConfig perform
信息: 正在将此操作记录到 /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2014_06_29_10_26_57.log。
2014-6-29 10:27:06 oracle.sysman.emcp.util.DBControlUtil stopOMS
信息: 正在停止 Database Control (此操作可能需要一段时间)...
2014-6-29 10:28:01 oracle.sysman.emcp.EMReposConfig stopDBMSJobs
警告: 初始化 SQL 连接时出错。无法执行 SQL 操作
2014-6-29 10:28:01 oracle.sysman.emcp.EMReposConfig invoke
警告: 无法移去 DBMS 作业。
2014-6-29 10:28:02 oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
警告: 初始化 SQL 连接时出错。无法执行 SQL 操作
2014-6-29 10:28:02 oracle.sysman.emcp.EMReposConfig invoke
信息: 正在删除 EM 资料档案库 (此操作可能需要一段时间)...
2014-6-29 10:29:57 oracle.sysman.emcp.EMReposConfig invoke
信息: 已成功删除资料档案库
已成功完成 Enterprise Manager 的配置
EMCA 结束于 2014-6-29 10:30:00
[oracle@station90 ~]$ emca -config dbcontrol db -repos recreate -silent -reconfig ports -DBCONTROL_HTTP_PORT 1158 -SID orcl -HOST 192.168.0.90 -SYS_PWD oracle_4U -PORT 1521 -DBSNMP_PWD oracle_4U -SYSMAN_PWD oracle_4U -EMAIL_ADDRESS '' -MAIL_SERVER_NAME '' -ASM_USER_PWD oracle_4U

EMCA 开始于 2014-6-29 10:33:31
EM Configuration Assistant, 11.2.0.0.2 正式版
版权所有 (c) 2003, 2005, Oracle。保留所有权利。

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

已指定以下设置

数据库 ORACLE_HOME ................ /u01/app/oracle/product/11.2.0/dbhome_1

本地主机名 ................ station90.example.com
监听程序 ORACLE_HOME ................ null
监听程序端口号 ................ 1521
数据库 SID ................ orcl
通知的电子邮件地址 ............... -MAIL_SERVER_NAME
通知的发件 (SMTP) 服务器 ............... null

-----------------------------------------------------------------
2014-6-29 10:33:34 oracle.sysman.emcp.EMConfig perform
信息: 正在将此操作记录到 /u01/app/oracle/cfgtoollogs/emca/orcl/emca_2014_06_29_10_33_31.log。
2014-6-29 10:33:43 oracle.sysman.emcp.ParamsManager checkParam
警告: 参数 EMAIL_ADDRESS 的值 -MAIL_SERVER_NAME 无效
2014-6-29 10:33:47 oracle.sysman.emcp.EMReposConfig invoke
信息: 正在删除 EM 资料档案库 (此操作可能需要一段时间)...
2014-6-29 10:33:52 oracle.sysman.emcp.EMReposConfig invoke
信息: 已成功删除资料档案库
2014-6-29 10:33:54 oracle.sysman.emcp.EMReposConfig createRepository
信息: 正在创建 EM 资料档案库 (此操作可能需要一段时间)...
2014-6-29 10:37:58 oracle.sysman.emcp.EMReposConfig invoke
信息: 已成功创建资料档案库
2014-6-29 10:38:08 oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
信息: 正在将配置数据上载到 EM 资料档案库 (此操作可能需要一段时间)...
2014-6-29 10:38:55 oracle.sysman.emcp.EMReposConfig invoke
信息: 已成功上载配置数据
2014-6-29 10:38:57 oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
信息: 软件库已配置成功。
2014-6-29 10:38:57 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
信息: 正在部署预配档案...
2014-6-29 10:39:26 oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
信息: 预配档案部署成功。
2014-6-29 10:39:26 oracle.sysman.emcp.util.DBControlUtil secureDBConsole
信息: 正在保护 Database Control (此操作可能需要一段时间)...
2014-6-29 10:39:53 oracle.sysman.emcp.util.DBControlUtil secureDBConsole
信息: 已成功保护 Database Control。
2014-6-29 10:39:53 oracle.sysman.emcp.util.DBControlUtil startOMS
信息: 正在启动 Database Control (此操作可能需要一段时间)...
2014-6-29 10:40:16 oracle.sysman.emcp.EMDBPostConfig performConfiguration
信息: 已成功启动 Database Control
2014-6-29 10:40:16 oracle.sysman.emcp.EMDBPostConfig performConfiguration
信息: >>>>>>>>>>> Database Control URL 为 https://station90.example.com:1158/em <<<<<<<<<<<
2014-6-29 10:40:21 oracle.sysman.emcp.EMDBPostConfig invoke
警告:
************************  WARNING  ************************

管理资料档案库已置于安全模式下, 在此模式下将对 Enterprise Manager 数据进行加密。加密密钥已放置在文件 /u01/app/oracle/product/11.2.0/dbhome_1/station90.example.com_orcl/sysman/config/emkey.ora 中。请务必备份此文件, 因为如果此文件丢失, 则加密数据将不可用。

***********************************************************
已成功完成 Enterprise Manager 的配置
EMCA 结束于 2014-6-29 10:40:21
[oracle@station90 ~]$ netstat -lntp | grep :1158
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp        0      0 :::1158                     :::*                        LISTEN      22190/java         
[oracle@station90 ~]$ cd $ORACLE_HOME
[oracle@station90 dbhome_1]$ ls
apex         config  dc_ocm               has               j2ee    lib      oc4j     oraInst.loc  precomp    sqldeveloper                ucp
assistants   crs     deinstall            hs                javavm  log      odbc     ord          racg       sqlj                        uix
bin          csmig   demo                 ide               jdbc    md       olap     oui          rdbms      sqlplus                     utl
ccr          css     diagnostics          install           jdev    mesg     ons      owb          relnotes   srvm                        wwg
cdata        ctx     dv                   install.platform  jdk     mgw      OPatch   owm          root.sh    station90.example.com_orcl  xdk
cfgtoollogs  cv      emcli                instantclient     jlib    network  opmn     perl         scheduler  sysman
clone        dbs     EMStagePatches_orcl  inventory         ldap    nls      oracore  plsql        slax       timingframework
[oracle@station90 dbhome_1]$ . oraenv
ORACLE_SID = [orcl] ? +ASM
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
[oracle@station90 dbhome_1]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 29 10:50:00 2014

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

SQL> conn / as sysdba
Connected.
SQL> conn / as sysasm
Connected.
SQL> ALTER DISKGROUP DATA ADD TEMPLATE "MYTEMPLATE10" ATTRIBUTES (MIRROR COARSE COLD MIRRORCOLD);
ALTER DISKGROUP DATA ADD TEMPLATE "MYTEMPLATE10" ATTRIBUTES (MIRROR COARSE COLD MIRRORCOLD)
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15283: ASM operation requires compatible.rdbms of 11.2.0.0.0 or higher


SQL> ALTER DISKGROUP mygroup ADD TEMPLATE "MYTEMPLATE10" ATTRIBUTES (MIRROR COARSE COLD MIRRORCOLD);
ALTER DISKGROUP mygroup ADD TEMPLATE "MYTEMPLATE10" ATTRIBUTES (MIRROR COARSE COLD MIRRORCOLD)
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15283: ASM operation requires compatible.rdbms of 11.2.0.0.0 or higher


SQL> alter diskgroup mygroup  set attribute 'compatible.rdbms'='11.2.0.0.0';

Diskgroup altered.

SQL> ALTER DISKGROUP mygroup ADD TEMPLATE "MYTEMPLATE10" ATTRIBUTES (MIRROR COARSE COLD MIRRORCOLD);

Diskgroup altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Automatic Storage Management option
[oracle@station90 dbhome_1]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 29 10:56:00 2014

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

SQL> conn / as sysasm
Connected.
SQL> alter diskgroup mygroup  set attribute 'compatible.rdbms'='10.1.0.0.0';
alter diskgroup mygroup  set attribute 'compatible.rdbms'='10.1.0.0.0'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15242: could not set attribute compatible.rdbms
ORA-15244: new compatibility setting less than current [11.2.0.0.0]


SQL> alter diskgroup data offline disk  data_0001 drop after 0.0 h;
alter diskgroup data offline disk  data_0001 drop after 0.0 h
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.0.0 or higher


SQL> alter diskgroup mygroup  set attribute 'compatible.rdbms'='11.1.0.0.0';
alter diskgroup mygroup  set attribute 'compatible.rdbms'='11.1.0.0.0'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15242: could not set attribute compatible.rdbms
ORA-15244: new compatibility setting less than current [11.2.0.0.0]


SQL> alter diskgroup data  set attribute 'compatible.rdbms'='11.1.0.0.0';

Diskgroup altered.

SQL> alter diskgroup data  set attribute 'compatible.rdbms'='11.2.0.0.0';

Diskgroup altered.

SQL> alter diskgroup data  set attribute 'compatible.rdbms'='11.1.0.0.0';
alter diskgroup data  set attribute 'compatible.rdbms'='11.1.0.0.0'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15242: could not set attribute compatible.rdbms
ORA-15244: new compatibility setting less than current [11.2.0.0.0]


SQL> alter diskgroup data offline disk  data_0001 drop after 0.0 h;

Diskgroup altered.

SQL> alter diskgroup mygroup  offline disk  mydisk2  drop after 0.0h;

Diskgroup altered.

SQL> alter diskgroup data  add disk  '/dev/raw/raw8'    data_0001 drop ;
alter diskgroup data  add disk    '/dev/raw/raw8'    data_0001 drop
                                                   *
ERROR at line 1:
ORA-00905: missing keyword


SQL> alter diskgroup data  add disk  '/dev/raw/raw8'  name  data_0001 drop ;
alter diskgroup data  add disk    '/dev/raw/raw8'  name  data_0001 drop
                                                                     *
ERROR at line 1:
ORA-00905: missing keyword


SQL> alter diskgroup data  add disk  '/dev/raw/raw8'  name  data_0001  ;

Diskgroup altered.

SQL> alter diskgroup data offline disk  data_0001 drop  after 3.6h;

Diskgroup altered.

SQL> alter diskgroup data  add disk  '/dev/raw/raw8'  name  data_0001  ;
alter diskgroup data  add disk    '/dev/raw/raw8'  name  data_0001
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15020: discovered duplicate ASM disk "DATA_0001"


SQL> alter diskgroup data online disk  data_0001;

Diskgroup altered.

SQL> alter diskgroup data offline disk  data_0001 drop  after 3.6h;

Diskgroup altered.

SQL> alter diskgroup data   drop   disk  data_0001 drop ;
alter diskgroup data   drop   disk  data_0001 drop
                                                  *
ERROR at line 1:
ORA-00905: missing keyword


SQL> alter diskgroup data   drop   disk  data_0001  ;
alter diskgroup data   drop   disk  data_0001
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15084: ASM disk "DATA_0001" is offline and cannot be dropped.


SQL> alter diskgroup data online disk  data_0001 ;
alter diskgroup data online disk  data_0001
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15281: not all specified disks were brought ONLINE
ORA-15284: ASM terminated ALTER DISKGROUP ONLINE
ORA-15282: ASM disk "DATA_0001" is not visible cluster-wide


SQL> alter diskgroup data   drop   disk  data_0001  force  ;

Diskgroup altered.

SQL> alter diskgroup data  add disk  '/dev/raw/raw8'  name  data_0001  ;

Diskgroup altered.

SQL>


























回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-5-6 18:27 , Processed in 0.042582 second(s), 24 queries .

快速回复 返回顶部 返回列表