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: