Performing a Switchover to a Physical Standby Database and failover
8.2.1 Performing a Switchover to a Physical Standby DatabaseThis section describes how to perform a switchover to a physical standby database.A switchover is initiated on the primary database and is completed on the target standby database.Step 1 Verify that the primary database can be switched to the standby role. Query the SWITCHOVER_STATUS column of the V$DATABASE view on the primary database.For example:SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;SWITCHOVER_STATUS -----------------
oracle dataguard setup
Creating Physical Standby using RMAN Duplicate Without Shutting down The Primary [ID 789370.1] -------------------------------------------------------------------------------- Modified 03-JUL-2010 Type HOWTO Status MODERATED In this Document Goal Solution References--------------------------------------------------------------------------------Platforms: 1-914CU; This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not bee
ROLLUP和CUBE语句。
Oracle的GROUP BY语句除了最基本的语法外,还支持ROLLUP和CUBE语句。如果是ROLLUP(A, B, C)的话,首先会对(A、B、C)进行GROUP BY,然后对(A、B)进行GROUP BY,然后是(A)进行GROUP BY,最后对全表进行GROUP BY操作。如果是GROUP BY CUBE(A, B, C),则首先会对(A、B、C)进行GROUP BY,然后依次是(A、B),(A、C),(A),(B、C),(B),(C),最后对全表进行GROUP BY操作。 grouping_id()可以美化效果: Oracle的GROUP BY语句除了最基本的语法外,还支持ROLLUP和CUBE语句。 除本文内容外,你还可参考:分析函数参考手册: http://xsb.i
plsql插入图片
create or replace directory gp as 'c:gp';insert into pict values('maoyaxi',empty_blob()); declaredest_lob blob;src_lob bfile:=bfilename('GP','maoyaxi.jpg');amount integer:=dbms_lob.getlength(src_lob);beginselect pict into dest_lob from pictwhere pictname='maoyaxi' for update;dbms_lob.fileopen(src_lob);dbms_lob.loadfromfile(dest_lob,src_lob,amount);dbms_lob.fileclose(Src_lob);commit;end;[@more@]
oracle utl_file
create or replace directory gp as 'c:gp';grant read, write on directory gp to maodeclare f utl_file.file_type; begin f := utl_file.fopen('GP', 'something.txt', 'w'); for i in 1..100 loop utl_file.put_line(f, 'line one: some text'); utl_file.put_line(f, 'line two: more text'); end loop; utl_file.fclose(f); end; declare f utl_file.file_type; buf VARCHAR2(200); v_id varchar2(20);BEGIN f := utl_file.fopen('GP', 'test.txt', 'R'); LOOP utl_file.get_line(f, buf);
行列转换
--行列转换 行转列DROP TABLE t_change_lc;CREATE TABLE t_change_lc (card_code VARCHAR2(3), q NUMBER, bal NUMBER);INSERT INTO t_change_lc SELECT '001' card_code, ROWNUM q, trunc(dbms_random.VALUE * 100) bal FROM dual CONNECT BY ROWNUM <= 4UNION SELECT '002' card_code, ROWNUM q, trunc(dbms_random.VALUE * 100) bal FROM dual CONNECT BY ROWNUM <= 4;SELECT * FROM t_change_lc;SELECT a.card_code, SUM(decode(a.q, 1, a.bal, 0)) q1, SUM(decode(a.q, 2, a.bal, 0)) q2, SUM(decode(a.q, 3,
rman不完全恢复
RMAN> run{2> set until time="to_date('20110120 17:31:00','yyyymmdd hh24:mi:ss')";3> restore database;4> recover database;5> }[@more@]
HDKZ
create table hdkz(riqi date,jiage number,xliang number,shou number,mm varchar2(2))hdkz.ctlload data infile 'c:hdkz.TXT' APPEND into table hdkz fields terminated by "," ( riqi, jiage, xliang, shou,mm )use strict;my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );$year += 1900;open(FR,"c:/gp/002184.TXT")||die "出错,不能打开 n";open(FW,">c:/gp/hdkz.TXT"
oracle 自治事务
create or replace trigger test_tri before update on test for each row declare PRAGMA AUTONOMOUS_TRANSACTION; begin insert into test values(2,'test2'); commit; end test_tri;[@more@]
Clusterware References
259301.1 CRS and 10g RAC This note contains a useful awk script to improve the output of crs_stat -ls 436067.1 Windows CRS_STAT script to display long names correctly 309541.1 How to start/stop the 10g CRS Clusterware 263897.1 How to stop Cluster Ready Services (CRS) 298073.1 How to remove CRS auto start and restart for a RAC instance 295871.1 How to verify if CRS install is valid 316583.1 VIPCA fails complaining that interface is not public 3412
Oracle EVENT用法参考列表
事件说明例子Event 10013 - Monitor Transaction Recovery在Startup时跟踪事务恢复ALTER SESSION SET EVENTS '10013 trace name context forever, level 1';Event 10015 - Dump Undo Segment Headers-在事务恢复后做Dump回退段头信息ALTER SESSION SET EVENTS '10015 trace name context forever, level 1';Event 10032 - Dump Sort StatisticsDump排序的统计信息ALTER SESSION SET EVENTS '10032 trace name context forever, level 10';Event 10033 - Dump Sort Intermediate Run Statistics排序过程中,内存排序区和临时表空间的交互
Oracle's Parallel
Parallel Features The full list of Oracle parallel execution features currently includes the following Parallel Query Parallel DML Parallel DDL Parallel Data Loading
ORACLE10g修改RAC VIP
ORACLE10g修改RAC VIP C O*rV$vXx01.确认当前VIP !t@iG
oracle 10046
http://www.eygle.com/case/Use.sql_trace.to.Diagnose.database.htm[@more@]
v session_wait v session_event v system_event
V$SYSTEM_EVENT 是oracle所有事件的鸟览图,它不包含session级的信息,但是它概括了从上次启动以来的所有的wait事件. Event 这是事件的名称.比如某些普通而最有意义的事件:enqueue, buffer busy waits, latch free, db file scattered read, db file sequential read, and free buffer waits. Total_Waits 这是从instance启动以来所给事件的等待次数. Total_Timeouts 这提供了所有等待超时的总次数 Time_Waited 这是全部等待时间(本次instance启动后所给定事件的阿全部等待时间),单位1/100秒. Average_Wait 这是平均等待时间,Average_Wait =
Enabling Archive Logs in a RAC Environment
Login to one of the nodes (i.e. racnode1) and disable the cluster instance parameter by setting cluster_database to FALSE from the current instance: $ sqlplus "/ as sysdba"SQL> alter system set cluster_database=false scope=spfile sid='racdb1'; Shutdown all instances accessing the clustered database:
undo机制工作原理描述的:
1. User 1 updates a record in block 777 (user 1 has not committed).2. User 2 queries the same block and sees that the lock byte is set for a row being queried.3. User 2 goes to the ITL portion of the block and gets the XID (transaction ID).4. The XID (transaction ID) maps to the UNDO block, which holds the information before the update was done. If using IMU, then a check is done to see if the undo for this transaction is available in memory before going to the UNDO block.5. A clone of the block
How To Identify a Hot Block Within The Database Buffer Cache. [ID 163424.1]
Possible hot blocks in the buffer cache normally can be identified by a high or rapid increasing wait count on the CACHE BUFFERS CHAINS latch. This latch is acquired when searching for data blocks cached in the buffer cache. Since the Buffer cache is implemented as a sum of chains of blocks, each of those chains is protected by a child of this latch when needs to be scanned. Contention in this latch can be caused by very heavy access to a single block. This can require the application to be rev
latch
SELECT event, time_waited,round(time_waited*100/ SUM (time_waited) OVER(),2) wait_pctFROM (SELECT event, time_waitedFROM v$system_eventWHERE event NOT IN('Null event','client message','rdbms ipc reply','smon timer','rdbms ipc message','PX Idle Wait','PL/SQL lock timer','file open','pmon timer','WMON goes to sleep','virtual circuit status','dispatcher timer','SQL*Net message from client','parallel query dequeue wait','pipe get') UNION(SELECT NAME, VALUEFROM v$sysstatWHERE NAME LIKE 'CPU used when
Oracle的硬解析和软解析(转)
说到软解析(soft prase)和硬解析(hard prase),就不能不说一下Oracle对sql的处理过程。当你发出一条sql语句交付Oracle,在执行和获取结果前,Oracle对此sql将进行几个步骤的处理过程: 1、语法检查(syntax check) 检查此sql的拼写是否语法。 2、语义检查(semantic check) 诸如检查sql语句中的访问对象是否存在及该用户是否具备相应的权限。 3、对sql语句进行解析(prase) 利用内部算法对sql进行解析,生成解析树(parse tree)及执行计划(execution plan)。 4、执行sql,返回结果(execute and return) 其中,软、硬解