Archive for 十一月 21st, 2007

VI命令

星期三, 十一月 21st, 2007

一、Search Functions 搜索
/exp Go forward to exp 从前往后开始搜索字符exp
?exp Go backward to exp 从后往前搜索字符exp

二、移动或着插入

Move and Insert Text 
:3,8d Delete line 3- 8  删除3到8行
:4,9m 12 Move lines 4-9 to 12把4-9行内容移动到12行
:2,5t 13 Copy lines 2-5 to 13 复制2-5行到13行
:5,9w file Write lines 5-9 to file

(更多…)

查看ORACLE运行的OS平台

星期三, 十一月 21st, 2007

SQL> run
  1  begin
  2  dbms_output.put_line(
  3  dbms_utility.port_string);
  4* end;
Linuxi386/Linux-2.0.34-8.1.0

PL/SQL 过程已成功完成。

10g 备用数据库各模式间的切换语法(Vongates)

星期三, 十一月 21st, 2007

–启动到恢复模式
startup mount;
alter database recover managed standby database disconnect from session;
–从恢复管理模式切换到只读模式
alter database recover managed standby database cancel;
alter database open;
–从只读模式切换到恢复管理模式
alter database recover managed standby database disconnect from session;
–关闭standby数据库
alter database recover managed standby database cancel;
shutdown immediate;
–直接启动到只读模式
startup;
–通过MRP0进程是否存在确认当前数据库所处的模式
select process, status from v$managed_standby;
–把备用数据库激活成主数据库
–alter database activate standby database;

lock查看

星期三, 十一月 21st, 2007

偶尔看到的. 

SELECT /*+ ORDERED USE_HASH(H,R) */
   H.SID HOLD_SID,
   R.SID WAIT_SID,
   decode(H.type,
           ”MR”, ”Media Recovery”,
           ”RT”, ”Redo Thread”,
           ”UN”, ”User Name”,
           ”TX”, ”Transaction”,
           ”TM”, ”DML”,
           ”UL”, ”PL/SQL User Lock”,
           ”DX”, ”Distributed Xaction”,
           ”CF”, ”Control File”,
           ”IS”, ”Instance State”,
           ”FS”, ”File Set”,
           ”IR”, ”Instance Recovery”,
           ”ST”, ”Disk Space Transaction”,
           ”TS”, ”Temp Segment”,
           ”IV”, ”Library Cache Invalidation”,
           ”LS”, ”Log Start or Switch”,
           ”RW”, ”Row Wait”,
           ”SQ”, ”Sequence Number”,
           ”TE”, ”Extend Table”,
           ”TT”, ”Temp Table”,
           H.type) type,
   decode(H.lmode,
           0, ”None”,         1, ”Null”,
           2, ”Row-S (SS)”,   3, ”Row-X (SX)”,
           4, ”Share”,        5, ”S/Row-X (SSX)”,
           6, ”Exclusive”,    to_char(H.lmode)) hold,
    decode(r.request,         0, ”None”,
           1, ”Null”,         2, ”Row-S (SS)”,
           3, ”Row-X (SX)”,   4, ”Share”,
           5, ”S/Row-X (SSX)”,6, ”Exclusive”,
           to_char(R.request)) request,
   R.ID1,R.ID2,R.CTIME
FROM VLOCK H,VLOCK R
WHERE H.BLOCK = 1 AND R.BLOCK=0
   and H.TYPE <> ”MR” AND R.TYPE <> ”MR”
   AND H.ID1 = R.ID1 AND H.ID2 = R.ID2

RMAN备份

星期三, 十一月 21st, 2007

备份控制文件:

run{
allocate channel dev1 type disk format ‘/usr/oracle/boson/backup_control%U’;
backup current controlfile;
}

检查备份的控制文件

list backup of controlfile

RMAN> list backup of controlfile;
List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
——- —- — ———- ———– ———— —————
25      Full    6.80M      DISK        00:00:01     21-NOV-07     
        BP Key: 25   Status: AVAILABLE  Compressed: NO  Tag: TAG20071121T112225
        Piece Name: /usr/oracle/boson/backup_control0sj1jm7i_1_1
  Control File Included: Ckp SCN: 12536946     Ckp time: 21-NOV-07
(更多…)