|
- [oracle@station90 dbhome_1]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 10:59:09 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> show parameter nls_date
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- nls_date_format string
- nls_date_language string
- SQL> select sysdate from dual;
- SYSDATE
- -------------------
- 2018-04-29:10:59:33
- SQL> show parameter terri
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- nls_territory string AMERICA
- SQL> ! echo $NLS_DATE_FORMAT
- YYYY-MM-DD:HH24:MI:SS
- SQL> alter system set nls_date_format='DD-MON-YYYY';
- alter system set nls_date_format='DD-MON-YYYY'
- *
- ERROR at line 1:
- ORA-02096: specified initialization parameter is not modifiable with this
- option
- SQL> alter session set nls_date_format='DD-MON-YYYY';
- Session altered.
- SQL> select sysdate from dual;
- SYSDATE
- --------------------
- 29-APR-2018
- SQL> show parameter nls_lang
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- nls_language string AMERICAN
- SQL> alter system set nls_language='korean';
- alter system set nls_language='korean'
- *
- ERROR at line 1:
- ORA-02096: specified initialization parameter is not modifiable with this
- option
- SQL> alter session set nls_language='korean';
- Session altered.
- SQL> select sysdate from dual;
- SYSDATE
- ----------------
- 29-4월 -2018
- SQL>
复制代码- SQL> show parameter open_cursor
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- open_cursors integer 300
- SQL> alter system set open_cursor=400;
- alter system set open_cursor=400
- *
- ERROR at line 1:
- ORA-02065: ALTER SYSTEM에 대한 부당한 옵션
- SQL> alter system set open_cursors=400;
- System altered.
- SQL> show parameter spfile
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- spfile string +DATA/orcl/spfileorcl.ora
复制代码
添加磁盘组:
- select * from v$asm_disk;
- select * from v$asm_diskgroup;
- alter diskgroup data add failgroup fg1 disk '/dev/raw/raw16' name DATA_0006
- failgroup fg2 disk '/dev/raw/raw17' name DATA_0007
- rebalance power 11;
复制代码 arbn进程:
归整故障组:
- select * from v$asm_disk;
- select * from v$asm_diskgroup;
- alter diskgroup data drop disk DATA_0005 disk DATA_0000 ;
- alter diskgroup data undrop disks;
- select * from v$asm_operation;
- alter diskgroup data add failgroup fg1 disk '/dev/raw/raw12' name DATA_0005
- failgroup fg2 disk '/dev/raw/raw7' name DATA_0000
- rebalance power 11;
-
- alter diskgroup data drop disk DATA_0004 disk DATA_0001 rebalance power 11 ;
- alter diskgroup data add failgroup fg1 disk '/dev/raw/raw11' name DATA_0004
- failgroup fg2 disk '/dev/raw/raw8' name DATA_0001
- rebalance power 11;
-
- alter diskgroup data drop disk DATA_0003 disk DATA_0002 rebalance power 11;
- alter diskgroup data add failgroup fg1 disk '/dev/raw/raw10' name DATA_0003
- failgroup fg2 disk '/dev/raw/raw9' name DATA_0002
- rebalance power 11;
-
复制代码
创建磁盘组:
- create diskgroup highdata high redundancy
- failgroup fg1 disk 'ORCL:ASMDISK1' name highdata_0001
- failgroup fg2 disk 'ORCL:ASMDISK2' name highdata_0002
- failgroup fg3 disk 'ORCL:ASMDISK3' name highdata_0003;
-
- select * from v$asm_disk;
- select * from v$asm_diskgroup;
复制代码
ASM磁盘组里的所有东西都是别名,“文件夹”的别名的“文件号”和“文件化身号”都是4294967295,而“文件”的文件号是比较小的数字而且在磁盘组内唯一,“文件”的“文件化身号”越大代表越新。所以如果要对磁盘组目录下的文件按照创建/修改时间来升序排序的话,要根据文件别名的第三列按照数字来排序:
[oracle@station90 ~]$ asmcmd ls +FRA/ORCL/ARCHIVELOG/2018_04_29 | sort -t . -k 3 -n
thread_1_seq_28.269.974716305
thread_1_seq_29.270.974716347
thread_1_seq_30.271.974716365
thread_1_seq_31.272.974716393
thread_1_seq_32.273.974716417
thread_1_seq_33.274.974716877
thread_1_seq_34.275.974718007
thread_1_seq_35.276.974724811
thread_1_seq_36.277.974730669
thread_1_seq_37.278.974732405
thread_1_seq_38.279.974736817
thread_1_seq_39.280.974736857
thread_1_seq_40.281.974739181
创建带自定义模板的表空间:
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 18:09:44 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> create tablespace tbshigh2 datafile '+highdata(temp1)' size 10M ;
- Tablespace created.
- SQL>
复制代码
一个normal冗余度的磁盘组具有最大的灵活性:既可以有(mirror coarse/fine)的模板,也可以有(high coarse/fine),更可以有(unprotected coarse/fine):
- select * from v$asm_alias where group_number=3;
- select * from v$asm_file where group_number=3 and file_number=258;
- select * from v$asm_template where group_number=3;
- alter diskgroup highdata add template temp1 attributes ( mirror fine );
- alter diskgroup highdata add template temp2 attributes ( unprotected coarse );
- select * from v$asm_template where group_number=3;
- -------------------
- select * from v$asm_template where group_number=1;
- alter diskgroup data add template temp1 attributes ( unprotected fine );
复制代码 关于别名:
- [oracle@station90 ~]$ asmcmd
- ASMCMD> ls
- DATA/
- FRA/
- HIGHDATA/
- ASMCMD> cd HIGHDATA/
- ASMCMD> ls
- ORCL/
- RCAT/
- ASMCMD> cd RCAT/
- ASMCMD> ls
- DATAFILE/
- ASMCMD> cd DATAFILE/
- ASMCMD> ls
- TBSHIGH.256.974741575
- TBSHIGH2.258.974743821
- ASMCMD> pwd
- +HIGHDATA/RCAT/DATAFILE
- ASMCMD> exit
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 18:21:29 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysasm
- Connected.
- SQL> alter diskgroup highdata add alias '+HIGHDATA/RCAT/DATAFILE/TBSHIGH2.dbf' for '+HIGHDATA/RCAT/DATAFILE/TBSHIGH2.258.974743821';
- Diskgroup altered.
复制代码 在数据库那边直接创建(还带模板):
- SQL> create tablespace tbshigh3 datafile '+highdata(temp1)/RCAT/DATAFILE/TBSHIGH3.dbf' size 10M;
- Tablespace created.
- SQL>
复制代码
暴力删除磁盘组:
- SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 18:21:29 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysasm
- Connected.
- SQL> alter diskgroup highdata add alias '+HIGHDATA/RCAT/DATAFILE/TBSHIGH2.dbf' for '+HIGHDATA/RCAT/DATAFILE/TBSHIGH2.258.974743821';
- Diskgroup altered.
- SQL> shutdown immediate
- ORA-15097: cannot SHUTDOWN ASM instance with connected client
- SQL> shutdown abort
- ASM instance shutdown
- SQL> startup
- ASM instance started
- Total System Global Area 283930624 bytes
- Fixed Size 2212656 bytes
- Variable Size 256552144 bytes
- ASM Cache 25165824 bytes
- ASM diskgroups mounted
- SQL> drop diskgroup highdata;
- drop diskgroup highdata
- *
- ERROR at line 1:
- ORA-15039: diskgroup not dropped
- ORA-15053: diskgroup "HIGHDATA" contains existing files
- SQL> drop diskgroup highdata including contents;
- Diskgroup dropped.
复制代码- Diskgroup dropped.
- create diskgroup highdata high redundancy
- failgroup fg1 disk 'ORCL:ASMDISK1' name highdata_0001
- failgroup fg2 disk 'ORCL:ASMDISK2' name highdata_0002
- 4 failgroup fg3 disk 'ORCL:ASMDISK3' name highdata_0003;
- Diskgroup created.
复制代码
另外一个用到它的库:
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 18:28:58 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected to an idle instance.
- SQL> startup
- ORACLE instance started.
- Total System Global Area 6680915968 bytes
- Fixed Size 2213936 bytes
- Variable Size 3556771792 bytes
- Database Buffers 3087007744 bytes
- Redo Buffers 34922496 bytes
- Database mounted.
- ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
- ORA-01110: data file 6: '+HIGHDATA/orcl/datafile/tbshighorcl.257.974741625'
- SQL> alter database create datafile 6 as new;
- Database altered.
- SQL> show parameter db_recovery_file
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- db_recovery_file_dest string +FRA
- db_recovery_file_dest_size big integer 3882M
- SQL> recover datafile 6;
- Media recovery complete.
- SQL> alter database open ;
- Database altered.
- SQL>
复制代码
|
|