<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Jcat
    寵辱不驚,閑看庭前花開花落~~
    posts - 173,comments - 67,trackbacks - 0
    純好人不用打:白羊

    沒人防:雙子(迷宮)、天平(卡妙的冰箱)、射手(迷宮)

    打死:巨蟹(紫龍)、山羊(紫龍自曝)、雙魚(阿瞬)、水瓶(冰河)

    沒打過,放水:獅子(星矢)、天蝎(冰河)、金牛(星矢)、處女(一輝)


    這樣看來紫龍是最NB的,一個人干掉2個,而且靠他師傅走后門天平不用打,還用天平的武器救了冰河。

    冰河和他師傅干了2仗
    冰河那段也挺NB,先是在天平被凍個半死,然后在天蝎被針扎個半死,最后到了水瓶還能把他師傅干掉
    冰河和他師傅是最體現實力的一仗,純實力對扣

    合著星矢誰也沒殺,就TM來打醬油的。。。
    posted @ 2011-10-21 14:29 Jcat 閱讀(562) | 評論 (1)編輯 收藏
    簡單過一遍,詳細的以后遇到慢慢研究。
    主要的更新在幾個方面:
    1. OUI的改進
    2. Oracle Restart
    3. ASM的增強!!!


    New Grid Infrastructure Installation Option
    ?1. 單點包括:ASM、listener和Oracle Restart(監控、管理并自動重啟各個組件)
    ?2. 集群包括:ASM、listener和Clusterware

    New Desktop and Server Class Options
    ?1. Desktop Class:適用于筆記本、臺式機
    ?2. Server Class:適用于服務器(功能上沒區別,多一些高級配置選項)

    Daylight Savings Time Upgrade of Timestamp with Timezone Data Type
    ?新的DBMS_DST包,優化對TIMESTAMP WITH TIMEZONE數據的管理

    SYSASM Privilege
    ?管理ASM需要SYSASM權限,旨在分清ASM管理和DB管理

    Fixup Scripts and Prerequisite Checks
    ?安裝前檢查時,如果遇到不符合要求的配置,OUI會對一些檢查項自動生成fixup腳本,用root執行就可以解決相應問題。

    New Tool to Configure Custom Installation Options
    ?OUI不在提供對單個組件的配置功能,如果需要只能用$ORACLE_HOME/bin/chopt命令行進行配置。我想Oracle的趨勢就是為了讓更多已經成熟的配置自動化,簡化使用。

    Deinstallation Tool
    ?OUI不再用來刪除oracle軟件,請使用$ORACLE_HOME/deinstall

    Intelligent Data Placement
    ?指定ASM磁盤的磁盤范圍,旨在將高頻訪問的數據放在HOT region(比如磁盤的外道)

    Oracle Automatic Storage Management Cluster File System (Oracle ACFS)
    ?為其它文件提供ASM的存儲功能

    Data Pump Export and Data Pump Import
    ?Data Pump兼容Export/Import

    Use Oracle Restart to Automatically Restart Your Database

    ?1. 針對單點環境
    ?2. 自動重啟又問題的組件,如:db instance、listener、asm instance

    New Method of Installing Oracle Automatic Storage Management
    ?以前,ASM的安裝是伴隨著DB的安裝;現在是伴隨著Software的安裝。
    ?其實,就是把ASM上升到一個軟件的高度(以前只是db的一個組件)

    SRVCTL Support for Single Instance Database in a Cluster
    ?SRVCTL統一管理單點(with Restart)和集群數據庫(with Clusterware)

    Deprecated in Oracle Database 11g Release 2
    ?不支持裸設備了:要么用文件系統、要么用ASM,說白了,企業環境就必須用ASM
    ?不支持Oracle Ultra Search(9i的一個什么鳥功能)






















    posted @ 2011-06-17 15:35 Jcat 閱讀(818) | 評論 (0)編輯 收藏
    重裝完系統,mysql不需要重裝,直接當綠色版使用,還更干凈

    //啟動MYSQL
    cd $MYSQL_HOME/bin
    D:\JAVA\MYSQL\mysql-5.1.53-win32\bin>mysqld --console??????
    110616? 1:26:26 [Note] Plugin 'FEDERATED' is disabled.
    InnoDB: The log sequence number in ibdata files does not match
    InnoDB: the log sequence number in the ib_logfiles!
    110616? 1:26:26? InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    110616? 1:26:26? InnoDB: Started; log sequence number 0 44233
    110616? 1:26:27 [Note] Event Scheduler: Loaded 0 events
    110616? 1:26:27 [Note] mysqld: ready for connections.
    Version: '5.1.53-community'? socket: ''? port: 3306? MySQL Community Server (GPL
    )

    //簡單使用

    mysql> show databases;
    +--------------------+
    | Database?????????? |
    +--------------------+
    | information_schema |
    | mysql????????????? |
    | test?????????????? |
    +--------------------+
    3 rows in set (0.03 sec)

    mysql> use mysql
    Database changed

    mysql> show tables;
    +---------------------------+
    | Tables_in_mysql?????????? |
    +---------------------------+
    | columns_priv????????????? |
    | db??????????????????????? |
    | event???????????????????? |
    | func????????????????????? |
    | general_log?????????????? |
    | help_category???????????? |
    | help_keyword????????????? |
    | help_relation???????????? |
    | help_topic??????????????? |
    | host????????????????????? |
    | ndb_binlog_index????????? |


    登陸
    D:\JAVA\MYSQL\mysql-5.1.53-win32\bin>mysql.exe -uroot
    創建數據庫
    mysql> create database testdb;




    posted @ 2011-06-16 01:40 Jcat 閱讀(932) | 評論 (1)編輯 收藏
    --主鍵是非分區索引,也可以看作是全局
    create table test_par1
    (
    ? tdate?? varchar2(8) primary key
    )
    partition by range ( tdate )
    (
    ???? partition p1 values less than ('20090201'),
    ???? partition p2 values less than ('20090301'),
    ???? partition pm values less than (MAXVALUE) ?
    ) tablespace test;


    --主鍵是分區索引
    create table test_par2
    (
    ? tdate?? varchar2(8)
    )
    partition by range ( tdate )
    (
    ???? partition p1 values less than ('20090201'),
    ???? partition p2 values less than ('20090301'),
    ???? partition pm values less than (MAXVALUE) ?
    ) tablespace test;

    create index i_tdate2 on test_par2(tdate) local;

    alter table test_par2 add constraint pk_tdate2 primary key(tdate);



    --查看test_par2的DDL
    select dbms_metadata.get_ddl( 'TABLE', 'TEST_PAR2' ) from dual;
    --整理如下
    create table test_par3
    (
    ? tdate?? varchar2(8),
    ? constraint pk_tdate3 primary key (tdate) using index local
    )
    partition by range ( tdate )
    (
    ???? partition p1 values less than ('20090201'),
    ???? partition p2 values less than ('20090301'),
    ???? partition pm values less than (MAXVALUE) ?
    ) tablespace test;


    這個案例也告訴我們,在做DDL時,盡量還是顯示的寫出屬性,一些簡易語法會引起不可知的定義。最后都用 get_ddl 再查一下,這才是Oracle真正執行的DDL。
    posted @ 2010-09-15 15:26 Jcat 閱讀(1285) | 評論 (0)編輯 收藏
    列出所有實例
    [db2inst1@dcm ~]$ db2ilist
    db2inst1

    列出當前實例下的所有數據庫

    [db2inst1@dcm ~]$ db2 list db directory

    ?System Database Directory

    ?Number of entries in the directory = 1

    Database 1 entry:

    ?Database alias?????????????????????? = SAMPLE
    ?Database name??????????????????????? = SAMPLE
    ?Local database directory???????????? = /home/db2inst1
    ?Database release level?????????????? = d.00
    ?Comment????????????????????????????? =
    ?Directory entry type???????????????? = Indirect
    ?Catalog database partition number??? = 0
    ?Alternate server hostname??????????? =
    ?Alternate server port number???????? =

    啟動實例
    [db2inst1@dcm ~]$ db2start
    07/09/2010 14:24:36???? 0?? 0?? SQL1063N? DB2START processing was successful.
    SQL1063N? DB2START processing was successful.

    連接到數據庫
    [db2inst1@dcm ~]$ db2 connect to sample

    ?? Database Connection Information

    ?Database server??????? = DB2/LINUX 9.7.1
    ?SQL authorization ID?? = DB2INST1
    ?Local database alias?? = SAMPLE

    執行SQL
    [db2inst1@dcm ~]$ db2
    db2 => select * from staff where dept=20

    ID???? NAME????? DEPT?? JOB?? YEARS? SALARY??? COMM??? ?
    ------ --------- ------ ----- ------ --------- ---------
    ??? 10 Sanders?????? 20 Mgr??????? 7? 98357.50???????? -
    ??? 20 Pernal??????? 20 Sales????? 8? 78171.25??? 612.45
    ??? 80 James???????? 20 Clerk????? -? 43504.60??? 128.20
    ?? 190 Sneider?????? 20 Clerk????? 8? 34252.75??? 126.50

    ? 4 record(s) selected.

    退出
    db2 => quit
    DB20000I? The QUIT command completed successfully.

    斷開連接(不斷開就不能db2stop)
    [db2inst1@dcm ~]$ db2 connect reset
    DB20000I? The SQL command completed successfully.

    關閉實例
    [db2inst1@dcm ~]$ db2stop
    07/09/2010 14:29:32???? 0?? 0?? SQL1064N? DB2STOP processing was successful.
    SQL1064N? DB2STOP processing was successful.

    posted @ 2010-07-09 14:32 Jcat 閱讀(254) | 評論 (0)編輯 收藏
    最近初探了一下DB2,發現關于“數據庫”、“實例”的概念及其關系容易把人弄暈,這里小小總結一下,并把Oracle也拉進來一起整。
    另外,發現Oracle和IBM老搞一些理論上就針鋒相對的事情,如RAC vs DPF (database partitioning feature),很是有趣。



    基本概念還是相同的
    數據庫軟件(下面簡稱軟件:軟件本身,一臺主機安裝一套就可以了。(拋開你故意在一臺服務器上安裝2遍Oracle/DB2這種不正常思維)

    實例:數據庫軟件啟動后的“進程+內存”
    軟件+實例的關系:一臺電腦只需要按照一套QQ(軟件),但是我們可以多用戶登錄(實例)。換到哲學的角度,就是抽象和具體的關系。
    數據庫(狹義,下面簡稱:一堆文件(數據文件、控制文件、日志文件、參數文件)
    它和軟件的區別:軟件是廠商賣給你的東西;是你自己的東西(業務、應用)
    它和實例的關系:用戶需要借助實例(所提供的各種手段)來訪問
    就相當于是QQ聊天記錄

    最后:數據庫(廣義)= 軟件 + 實例 + 庫
    一臺服務器(即一套數據庫軟件)可以建多個實例,多個庫,且互不相干


    體系結構的不同之處
    Oracle? 實例和庫一一對應
    DB2???? 一個實例可以掛多個庫


    高級情況(簡單提一下,以后再慢慢研究)
    Oracle:RAC一個庫被多個實例掛
    DB2:DPF一個實例多個庫
    在數據庫集群模式設計方面,有Share everything架構和Share nothing架構,前者以ORACLE RAC為代表,IBM DB2 Purescale為挑戰者;后者以IBM DB2 DPF為代表。

    posted @ 2010-07-08 18:26 Jcat 閱讀(426) | 評論 (0)編輯 收藏
    行鏈接:
    1. 一條記錄的大小大于block size,則產生行鏈接
    2. 容易發生在比較大的行上
    3. 因為行鏈接是由db_block_size不夠大引起的,所以對已有的行鏈接是無法清除的
    4. 9i以后,可以對不同的表空間設置不同的db_block_size,可以將一些特殊的寬表放在大block size的表空間

    例子:
    表空間block size為8k(8192),因為數據塊頭也要占一定空間,所以如下例,實際只能放7948的數據,一旦超過,就產生行鏈接

    --無
    create table test7948(a char(2000),b char(2000),c char(2000),d char(1948))
    tablespace test;

    insert into test7948 values('a','b','c','d');
    commit;

    --有
    create table test7949(a char(2000),b char(2000),c char(2000),d char(1949))
    tablespace test;

    insert into test7949 values('a','b','c','d');
    commit;



    行遷移:
    1. 本來是放的下的
    2. 因為更新使row size變大了,一個block里又不足以放下增加的空間(PCTFREE相關),則產生行遷移
    3. 容易發生在PCTFREE較小,對類似varchar類型的update又很多的表上
    4. 無法避免,但通過把數據導出導入進行清除

    例子:
    --無
    create table test7948_vchar(a char(2000),b char(2000),c char(2000),d char(1940), e varchar(9))
    tablespace test;

    insert into test7948_vchar values('a','b','c','d','12345678');
    commit;

    一更新,使得row size大于7948了,產生行遷移
    --有
    update test7948_vchar set e='123456789'
    posted @ 2010-06-13 14:08 Jcat 閱讀(235) | 評論 (0)編輯 收藏
    隨著Oracle收購SUN,今天又爆出SAP收購Sybase的大料。

    現狀:
    Oracle和IBM已經成為諾亞方舟級的廠商,啥都有。
    微軟,SAP成為航母級的廠商,軟件方面啥都有,但目前沒有硬件。

    猜想:who's next? Dell? HP?
    不然微軟把Dell收了吧,組成BDll公司;
    然后SAP和HP合并為SHP
    posted @ 2010-05-14 11:24 Jcat 閱讀(243) | 評論 (0)編輯 收藏
    --創建一個大一點的TEMP表空間
    create temporary tablespace temp1
    tempfile '/oracledatafile/temp01.dbf' SIZE 100m autoextend on next 100m maxsize 5000m;
    ?
    --切換默認TEMP表空間
    alter database default temporary tablespace temp1;

    --刪掉以前的TEMP表空間
    drop tablespace temp including contents and datafiles;
    posted @ 2010-04-30 11:05 Jcat 閱讀(285) | 評論 (0)編輯 收藏
    1. 物化視圖由于是物理真實存在的,故可以創建索引。




    --為基表創建MLOG
    --創建物化視圖時應先創建存儲的日志空間,否則建MV時報錯
    --ORA-23413: table "SCOTT"."EMP" does not have a materialized view log

    create materialized view log on scott.emp
    tablespace test
    /


    --創建物化視圖
    create materialized view test_mv
    tablespace test
    parallel (degree 4)
    build immediate refresh fast
    enable query rewrite
    as
    select * from scott.emp
    /


    --查看一下結果,果然很符合物化視圖的定義,一個表+一個視圖
    SQL> select object_name, object_type from user_objects where object_name = 'TEST_MV';
    OBJECT_NAME??? OBJECT_TYPE
    -----------??? --------
    TEST_MV??? ??? TABLE
    TEST_MV??? ??? MATERIALIZED VIEW

    SQL> select mview_name, container_name from user_mviews;
    MVIEW_NAME?????? CONTAINER_NAME
    ---------------- ------------------------------
    TEST_MV????????? TEST_MV? (這就是那個存儲表)

    --查看MLOG的情況
    --注意:MLOG的所屬和MV的所屬并不是同一個
    SQL> select log_owner, master, log_table from dba_mview_logs
    LOG_OWNER??? MASTER??? LOG_TABLE
    ---------------------------------
    SCOTT??? ??? EMP??? MLOG$_EMP (MLOG其實也就是一個表)

    SQL> desc scott.mlog$_emp;
    Name??? ??? ??? Type
    -------------------------------
    EMPNO??? ??? ??? NUMBER(4)
    SNAPTIME$$??? ??? DATE
    DMLTYPE$$??? ??? VARCHAR2(1)
    OLD_NEW$$??? ??? VARCHAR2(1)
    CHANGE_VECTOR$$??? ??? RAW(255)



    --刪除MLOG
    drop materialized view log on 物化視圖所依賴的表名;?
    --刪除物化視圖
    drop materialized view 物化視圖名;
    posted @ 2010-01-13 00:04 Jcat 閱讀(534) | 評論 (2)編輯 收藏
    注意,為了能在終端看見put_line的輸出,還需要先開啟
    set serveroutput on

    ?

    --用來測試的表
    create table test_tri(
    a1 int,
    a2 int
    )
    tablespace test


    -----行級insert觸發器
    -----
    1) 插入的一行新數據保存在:new
    2)
    insert觸發器沒有:old值
    3) 對:new的修改,只能定義在before類型的觸發器中

    ---觸發器語法---
    create or replace trigger 名稱
    [after|before] [delete|update|insert]
    [of 列名] [on 表名]
    [referencing new as 新行別名 old as 舊行別名]
    [for each row] [when(條件)]
    declare
    ....
    begin
    ...
    exception
    ....
    end;


    --定義
    create or replace trigger test_before_insert
    before insert on test_tri
    for each row when(new.a2 is null)
    begin
    ?? ?dbms_output.put_line('insert row original: a1=' || :new.a1 || ' a2=' || :new.a2);
    ?? ?:new.a2 := :new.a1 * 2;? ?
    end;
    /

    create or replace trigger test_after_insert
    after insert on test_tri
    for each row
    begin
    ?? ?dbms_output.put_line('insert row actual: a1=' || :new.a1 || ' a2=' || :new.a2);? ?
    end;
    /

    --測試

    SQL> insert into test_tri(a1) values(1);
    insert row original: a1=1 a2=
    insert row actual: a1=1 a2=2

    SQL> insert into test_tri values(2,3);
    insert row actual: a1=2 a2=3

    SQL> select * from test_tri;
    ??????? A1???????? A2
    ---------- ----------
    ???????? 1????????? 2(由觸發器生成的值)
    ???????? 2????????? 3



    -----DDL觸發器-----
    --任何create語句都會觸發這個語句

    create or replace trigger test_ddl_trigger
    before create on schema
    begin
    ??? dbms_output.put_line( 'DDL Trigger' );
    ??? insert into test_tri values(9,9);
    end;
    posted @ 2010-01-11 14:58 Jcat 閱讀(259) | 評論 (0)編輯 收藏
    Oracle建好后,tnsnames和listener中自動就帶有如下內容,這里咱們就來解釋一下這些東西是干什么用的

    ----TNSNAMES.ora----
    EXTPROC_CONNECTION_DATA =
    ? (DESCRIPTION =
    ??? (ADDRESS_LIST =
    ????? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    ??? )
    ??? (CONNECT_DATA =
    ????? (SID = PLSExtProc)
    ????? (PRESENTATION = RO)
    ??? )
    ? )

    ----LISTENER.ora----
    SID_LIST_LISTENER =
    ? (SID_LIST =
    ??? (SID_DESC =
    ????? (SID_NAME = PLSExtProc)
    ????? (ORACLE_HOME = /opt/oracle/10gR2)
    ????? (PROGRAM = extproc)
    ??? )
    ? )

    LISTENER =
    ? (DESCRIPTION_LIST =
    ??? (DESCRIPTION =
    ????? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    ????? (ADDRESS = (PROTOCOL = TCP)(HOST = dcm)(PORT = 1521))
    ??? )
    ? )


    IPC - Inner Process Communication
    When a process is on the same machine as the server, use the IPC protocol for connectivity instead of TCP. Inner Process Communication on the same machine does not have the overhead of packet building and deciphering that TCP has.
    I've seen a SQL job that runs in 10 minutes using TCP on a local machine run as fast as one minute using an IPC connection. The difference in time is most dramatic when the Oracle process has to send and/or receive large amounts of data to and from the database.
    For example, a SQL*Plus connection that counts the number of rows of some tables will run about the same amount of time, whether the database connection is made via IPC or TCP. But if the SQL*Plus connection spools much data to a file, the IPC connection will often be much faster -- depending on the data transmitted and the machine workload on the TCP stack.

    For how to configure it:
    1. you should add one IPC line in the LISTENER.ORA
    2. You should also add one IPC line in the TNSNAMES.ORA



    PLSExtPro - PL/Sql External Procdure
    默認安裝時,會安裝一個PL/SQL外部程序(extproc--這是程序名)條目在listener.ora中,是oracle為調用外部程序默認配置的監聽,它的名字(也就是SID)通常是ExtProc或PLSExtProc
    但一般不會使用它,可以直接從listener.ora中將這項移除,因為對ExtProc已經有多種攻擊手段了,在不使用外部程序時,Oracle也是建議刪除的。



    extproc的作用
    就是在pl/sql中調用外部語句,如c,java寫的過程。
    現在,Oracle已經全面支持JAVA了,這東西也就過時了,之所以繼續保留是考慮到兼容以前老版本的數據庫實例。

    [oracle@dcm bin]$ extproc
    Oracle Corporation --- TUESDAY?? JAN 05 2010 21:58:23.878
    Heterogeneous Agent Release 10.2.0.1.0 - Production

    posted @ 2010-01-05 21:59 Jcat 閱讀(652) | 評論 (0)編輯 收藏
    --登錄sys用戶,創建一個測試用戶,權限可以給大點
    SQL> create user test identified by xxxxx;
    SQL> grant connect to test;
    SQL> grant resource to test;
    SQL> grant dba to test;


    --登錄test用戶,開始測試
    --建個測試表
    create table test_table(id int, time timestamp);

    --創建Job
    begin
    dbms_scheduler.create_job(
    ?? ?job_name => 'test_job',
    ?? ?job_type => 'PLSQL_BLOCK',
    ?? ?job_action => 'insert into test_table
    ????????????????? (select nvl(max(id),0)+1, systimestamp from test_table, dual);', --nvl函數同SQLServer的isnull函數
    ?? ?start_date => null, --一激活,就開始
    ?? ?repeat_interval => 'FREQ=SECONDLY;INTERVAL=10');
    end;

    FREQ用來指定間隔的時間周期,可選參數有:YEARLY,MONTHLY,WEEKLY,DAILY,HOURLY,MINUTELY,SECONDLY。

    --光創建沒用,還需要激活;也可以在創建時,直接把enable屬性設置為true(enabled => true
    select job_name, enabled, run_count from user_scheduler_jobs;
    JOB_NAME?????????????????????? ENABL? RUN_COUNT
    ------------------------------ ----- ----------
    TEST_JOB?????????????????????? FALSE????????? 0


    begin
    dbms_scheduler.enable('test_job');
    end;

    --查看效果
    select id, to_char(time,'HH24:MI:SS:FF3') from test_table;
    ?????? ID? TO_CHAR(TIME,'HH24
    ---------- ------------------
    ???????? 1 16:13:29:542
    ???????? 2 16:13:39:506
    ???????? 3 16:13:49:109
    ???????? 4 16:13:59:097
    ???????? 5 16:14:09:109
    ???????? 6 16:14:19:103
    ???????? 7 16:14:29:101
    ???????? 8 16:14:39:099
    ???????? 9 16:14:49:105
    ??????? 10 16:14:59:100


    --停止任務
    begin
    dbms_scheduler.disable('test_job');
    end;

    --刪除任務
    begin
    dbms_scheduler.drop_job('test_job');
    end;
    posted @ 2009-12-17 16:13 Jcat 閱讀(247) | 評論 (0)編輯 收藏

    一致和并發是對立的,需要根據應用,選擇權宜之計


    數據不一致的現象

    ---事務內單SQL的情況---
    1.臟讀-Dirty Read:本事務讀取了其它事務尚未提交的修改數據
    例子:讀了不該讀的
    1:00 x=1
    1:01 A用戶 Update x=2(但未commit)
    1:02 B用戶 Select x --> x=2
    合理的情況是x仍然等于1

    ---事務內多SQL的情況(典型的如,先查再改)---
    2.不可重復讀-Non Repeatable Read
    例子1:自相矛盾
    1:00 x=1 y=2
    1:01 B用戶 Select x,y --> x=1 y=2
    1:02 A用戶 Update x=2; Commit;
    1:03 B用戶 Select x+y --> x+y=4
    首先這個結果從單條SQL的角度看,是沒有問題的。但是,如果把B的兩次查詢看作一個整體(事務),那么合理的情況應該是
    ? x+y仍然等于3
    ? 或者B再進行一次事務,得出 x=2 y=2 x+y=4 的結果


    例子2:更新丟失
    1:00 x=1
    1:01 B用戶 Select x --> x=1
    1:02 A用戶 Select x --> x=1
    1:03 A用戶 Update x=2; Commit;
    1:04 B用戶 Update x=3; Commit;
    同樣,從單條SQL來講,沒有任何問題。
    但是從邏輯的合理性講,一般的更新操作都是先查再改,換言之
    ? A真正想做的是Update x from 1 to 2
    ? B真正想做的是Update x from 1 to 3
    但最終卻造成了在B不知情的情況下,把B的初衷改為了Update x from 2 to 3


    3.幻影讀-Phantom Read
    例子:讀到了未來
    1:00 X1=1 X2=2
    1:01 B用戶 Select Xi --> X1=1 X2=2
    1:02 A用戶 Insert X3=3; Commit;
    1:03 B用戶 Select sum(Xi) --> re=6
    其實道理和之前的不可重復讀相同,只不過是由Insert引起的罷了。
    (甚至Delete也會引起類似的問題,但好像學術界并沒有對Delete進行討論)




    Isolation Level
    Read Uncommitted:1,2,3都會發生
    ? Oracle中嚴格禁止臟讀
    ? 在SQL Server 7.0中,是可以選擇該級別的
    Read Committed:發生2,3(Oracle的默認級別)
    Repeatable Read:發生3
    Serializable:都不發生


    Oracle的實現方式
    Read Committed:默認就實現
    Repeatable Read:
    ? 1. 悲觀鎖(select ... for update),影響并發
    ? 2. 樂觀鎖(update where 所有字段都作為條件),不影響并發
    Serializable:
    ? alter session set isolation_level=serializable/read only
    posted @ 2009-12-05 17:45 Jcat 閱讀(218) | 評論 (0)編輯 收藏


    因為在客戶那工作不能上網,決定辦一張3G上網卡(公司報銷),中午分別去電信和移動了解了一下:
    電信 960元? 7個月? 300小時/月
    移動 880元? 7個月? 15G/月 (目前推廣期,不限流量)
    (都包含上網貓)
    這樣算下來還是移動的便宜,去搞了個移動的。

    關于移動的上網貓,開始給我測試的時候用的是華為的、白色、流線型還挺好看。最終給我的是一個鳥公司的(敏訊),方形真難看,太大了,號稱還是升級版。

    速度嘛,看網頁沒啥問題,Outlook下郵件也很快,在線聽歌也沒問題,在線電影就不去嘗試了,免得傷自尊,辦公足夠了。玩開心網有點卡。(我以前就用過聯通的CDMA-2G上網,那叫一個慢呀)

    這個帖子就是用3G網絡發的,哈哈。同時紀念一下2年后重回BMW做項目。
    posted @ 2009-09-17 19:09 Jcat 閱讀(233) | 評論 (0)編輯 收藏
    扇區(sector):最小的可尋址單元,512byte
    磁道(track):一圈扇區
    磁柱(cylinder):一摞磁道

    每一磁道的扇區數是一樣的,但是存儲密度不同,外疏內密。

    為什么要外疏內密?
    角速度相同時,線速度與半徑成正比:
    硬盤為了提高其軸壽命,軸的轉動速度是一定的。磁頭在硬盤上讀寫數據是近乎于圓弧的路線,而越往外,線速度就越快。為了保證讀取的準確性只能減小外道的密度使磁頭讀取數據的時間間隔是相同的。


    有待研究:早期的磁盤每個磁道上的扇區數目是一樣,顯然浪費了外圈的容量,后來為了增大磁盤容量采用了新技術,也就是說越往外每磁道扇區數目越多。

    posted @ 2009-09-14 15:50 Jcat 閱讀(382) | 評論 (0)編輯 收藏
    字符設備:按照字符流的方式被有序訪問,不能隨機存取,如鍵盤、串口打印機、磁帶。

    塊設備:能夠隨機(不需要按順序)訪問固定大小數據片(chunks),采用塊緩沖技術,如硬盤、軟盤、光驅。

    裸設備:是一種沒有經過格式化,不被Unix通過文件系統來讀取的特殊字符設備。
    現在問題來了,Oracle在使用裸設備時(如ASM、甚或表空間直接建在裸設備上),難道還是順序存取?顯然不符合事實。
    其實,說裸設備是字符設備,只是從操作系統的角度來說的;從使用裸設備的應用程序(如Oracle)的角度,還是塊設備,Oracle會去對磁盤進行分塊管理。

    邏輯卷是邏輯概念,可以包含多塊物理硬盤,實現了存儲跨盤功能,同時提供了數據復制機制,提供了數據安全保護機制。

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

    裸設備適用于每次改動數據較小、需大量并發交易,OLTP;
    對于大規模順序讀寫,裸設備性能是最差的,所以對OLAP,應使用塊設備或卷。

    posted @ 2009-09-14 13:45 Jcat 閱讀(598) | 評論 (0)編輯 收藏
    --創建一個分區表
    create table scott.testpart
    (
    ?? ?TEXTDATE?? VARCHAR2(8)
    )
    partition by range ( TEXTDATE )
    (
    ?? ? partition p1 values less than ('20090201'),
    ??? ?partition "p2" values less than ('20090301'), --注意這里的雙引號
    ?? ? partition pm values less than (MAXVALUE) ?
    )


    --插入一些數據(順便實踐一下雙層循環)

    DECLARE
    ?? ?i int:=1;
    ?? ?j int:=1;
    BEGIN
    ? ??? ?WHILE i<=3 LOOP
    ?? ??? ???? WHILE j<=3 LOOP
    ?? ??? ??? ???? insert into scott.testpart values (2009*10000+i*100+j);
    ???? ??? ??? ?? j:=j+1;
    ?? ??? ???? END LOOP;???? ??? ?
    ?? ???? i:=i+1;?? ?
    ?? ???? j:=1; --注意要重置j,否則就回不到j循環里面了
    ?? ???? END LOOP;
    END;


    --需要先進行分析,否則num_rows列將為空
    analyze table scott.testpart compute statistics;

    --查看各個分區的情況
    select table_name, partition_name, num_rows from DBA_TAB_PARTITIONS
    where table_owner='SCOTT' and table_name='TESTPART';
    TABLE_NAME??????????????? PARTITION_NAME?????????? NUM_ROWS
    -------------------------- ------------------------------ ----------
    TESTPART?????????????????????? P1?????????????????????????????????? ? ?? ?? ?? 3
    TESTPART?????????????????????? PM????????????????????????????????? ? ? ?? ?? 3
    TESTPART?????????????????????? p2?????????????????????????????????????? ? ? ? 3
    注意p2因為加了引號仍然是小寫(但并不顯示引號,這點比較討厭),沒加引號的會顯示為大寫


    --驗證數據確實進入了正確的分區
    select * from scott.testpart partition(p1);
    TEXTDATE
    --------
    20090101
    20090102
    20090103

    --創建p2時有引號,使用p2時也就需要引號。
    --特別的,用一些第三方客戶端創建分區表時,生成的SQL往往會自動加上引號,而查看DBA_TAB_PARTITIONS時又看不出來,所以遇到下面的問題,可以加個引號試試。
    select * from scott.testpart partition(p2);
    ERROR at line 1:
    ORA-02149: Specified partition does not exist

    select * from scott.testpart partition("p2");
    TEXTDATE
    --------
    20090201
    20090202
    20090203


    --其它相關
    select * from scott.testpart;
    truncate table scott.testpart;
    drop table scott.testpart;

    posted @ 2009-08-18 18:17 Jcat 閱讀(264) | 評論 (0)編輯 收藏
    股票的面值,是股份公司在所發行的股票票面上標明的票面金額,它以元/股為單位,其作用是用來表明每一張股票所包含的資本數額。在我國上海和深圳證券交易所流通的股票的面值均為壹元,即每股一元。
    一般來說,股票的發行價格都會高于其面值。當股票進入流通市場后,股票的面值就與股票的價格沒有什么關系了。股民愛將股價炒到多高,它就有多高。

    按股東權利分類,股票可分為普通股、優先股和后配股。在我國上交所與深交所上市的股票都是普通股

    股息紅利作為股東的投資收益,是以股份為單位計算的貨幣金額,如每股多少元。但在上市公司實施具體分派時,其形式可以有四種:這就是現金股利、財產股利、負債股利和股票股利等。滬深股市的上市公司進行利潤分配一般只采用股票紅利和現金紅利兩種,即統稱所說的送紅股和派現金。
    當上市公司向股東分派股息時,就要對股票進行除息;當上市公司向股東送紅股時,就要對股票進行除權。
    我國上市公司中約有一半以上的股份為國家股,且其股權代表基本上都是上市公司的經營管理人員。由于切身利益的影響,經營管理人員基本上都贊同企業的發展與擴張,所以我國上市公司的分紅中,送紅股的現象就非常普遍。
    posted @ 2009-07-29 11:17 Jcat 閱讀(174) | 評論 (0)編輯 收藏
    硬鏈接
    [oracle@dcm ~]$ ln original.file hard.link

    軟鏈接
    [oracle@dcm ~]$ ln -s original.file soft.link


    [oracle@dcm ~]$ ls -l
    -rw-r--r-- 2 oracle oinstall??? 4 Jul 14 17:21 original.file
    -rw-r--r-- 2 oracle oinstall??? 4 Jul 14 17:21 hard.link
    lrwxrwxrwx 1 oracle oinstall?? 13 Jul 14 17:23 soft.link -> original.file

    鏈接數只是和硬鏈接相關的一個概念
    從鏈接文件可以跟蹤到軟鏈接的指向(無法反向跟蹤)



    ---------------
    由于inode這種文件系統結構不是雙向的,不能查找一個inode被reference了多少次。我們只能通過一些技巧來跟蹤硬鏈接。
    1. 通過鏈接數,我們可以知道哪個文件有硬鏈接(大于1)
    2. 查找該文件的inode id
    [oracle@dcm ~]$ ls -i hard.link
    1573158 hard.link
    3. 通過inode id查找文件(如果需要遍歷的目錄很多,速度自然可想而知)
    [oracle@dcm ~]$ find -inum 1573158
    ./hard.link
    ./original.file
    4. 硬鏈接本質上是多個dentry指向同一個inode,所以并沒有主從之分,每個dentry都是平等的。

    posted @ 2009-07-14 17:40 Jcat 閱讀(257) | 評論 (0)編輯 收藏
    --修改后重新啟動數據庫,永久生效
    SQL> alter system set nls_date_format='yyyymmdd';
    ERROR at line 1: --不能是memory scope(默認是both,所以也不行)
    ORA-02096: specified initialization parameter is not modifiable with this option

    SQL> alter system set nls_date_format='yyyymmdd' scope=spfile;
    System altered.

    SQL> show parameter nls_date_format? --這個時候還沒生效
    NAME???????????????????????????????? TYPE??????? VALUE
    ------------------------------------ ----------- ------------------------------
    nls_date_format????????????????????? string

    --重啟數據庫后
    SQL> show parameter nls_date_format
    NAME???????????????????????????????? TYPE??????? VALUE
    ------------------------------------ ----------- ------------------------------
    nls_date_format????????????????????? string????? yyyymmdd

    SQL> select sysdate from dual;
    SYSDATE
    --------
    20090627



    --只對當前session有效,重登錄一次SQLPLUS,效果就消失了
    SQL> alter session set nls_date_format='yyyy-mm-dd';?? --這個格式也很常用 yyyy-mm-dd hh:mi:ss
    Session altered.? --同時會覆蓋初始化參數里的設置

    SQL> select sysdate from dual;
    SYSDATE
    ----------
    2009-06-27
    posted @ 2009-06-27 16:18 Jcat 閱讀(683) | 評論 (0)編輯 收藏
    Oracle所有對象的相關信息都可以通過靜態數據字典來查找,但數據字典實在太多,也記不清名字。
    因為數據字典都是以DBA_開頭的視圖,所以可以想辦法先把它們列出來。
    btw,DBA>ALL>User

    以下兩句結果上是等效的
    select object_name from dba_objects where object_name like 'DBA\_%' escape '\' and object_type='VIEW';
    select view_name from dba_views where view_name like 'DBA\_%' escape '\';



    例子:
    我想查看數據文件的相關信息,但是從DBA_DATA_FILES里,并沒有看見Temp表空間的數據文件的信息。
    于是可以嘗試如下搜索:
    SQL> select view_name from dba_views where view_name like 'DBA\_%TEMP%' escape '\';
    VIEW_NAME
    ------------------------------
    DBA_ADVISOR_SQLW_TEMPLATES
    DBA_ADVISOR_TEMPLATES
    DBA_HIST_BASELINE_TEMPLATE
    DBA_LOB_TEMPLATES
    DBA_REPCAT_REFRESH_TEMPLATES
    DBA_SUBPARTITION_TEMPLATES
    DBA_TEMPLATE_REFGROUPS
    DBA_TEMPLATE_TARGETS
    DBA_TEMP_FILES??? --找到嫌疑犯,進去一看,果然記錄的是關于Temp表空間的數據文件的信息
    DBA_TEMP_FREE_SPACE


    列一些常用的在這吧

    posted @ 2009-06-18 22:42 Jcat 閱讀(301) | 評論 (0)編輯 收藏
    這兩個命令都是用來更改一些數據庫配置的,所以經常容易混淆,如:
    >alter database drop logfile group 1;
    >alter system switch logfile;
    >alter system kill session 'sid,serial#';

    為了方便記憶,歸納如下:
    alter database (改變數據庫--database)
    和物理文件直接相關的操作

    alter system (改變實例--instance)
    不直接牽涉到磁盤文件的操作


    當然,這只是為了方便記憶,只滿足大部分的情況,并不是所有的命令都能套到這個框框里,最終還是用熟了就記住哪個是哪個了。


    ---外傳---
    oracle server=Instance (memory structure) + Database (disk file) + U/S Process
    ?? Instance=SGA + Background Process
    ?? Database=control file + data file + log file
    ?? U/S Process= User Process + Server Process + PGA

    posted @ 2009-06-16 12:32 Jcat 閱讀(228) | 評論 (0)編輯 收藏
    《道路交通安全法實施條例》第四十九條規定,機動車在有禁止掉頭或者禁止左轉彎標志、標線的地點以及在鐵路道口、人行橫道、橋梁、急彎、陡坡、隧道或者容易發生危險的路段,不得掉頭;機動車在沒有禁止掉頭或者沒有禁止左轉彎標志、標線的地點可以掉頭,但不得妨礙正常行駛的其他車輛和行人的通行。在允許掉頭的地點設有掉頭專用信號燈的,應當在綠燈期間掉頭;未設有掉頭信號燈的,但有相應的標志標明在紅燈或者綠燈期間掉頭的,應當按照標志的指示掉頭;既無掉頭專用信號燈,又無其他標志指示的,掉頭時可不受信號燈限制,但掉頭時不得妨礙正常行駛的車輛和行人通行。

    -----

    有下列情形之一的,依法予以處罰:
    ?? (1)在設有禁止掉頭(禁止左轉彎)標志、標線的地點掉頭的;??? ?
    ?? (2)在人行橫道處掉頭的;
    ?? (3)在非禁止掉頭的地點掉頭與正常行駛的車輛、行人發生交通事故的,按掉頭時妨礙正常行駛的車輛通行或掉頭時妨礙正常行駛的行人通行的行為予以處罰。
    ?? (4)沒有從左側第一條車道(設置專用掉頭車道的除外)掉頭的,按掉頭時未按規定駛入最左側車道的行為進行處罰。

    -----

    (一)下列情形,不屬于違法行為:
    ??? (1)在沒有禁止掉頭(禁止左轉彎)標志、標線的地點掉頭的;
    ??? (2)在沒有禁止掉頭(禁止左轉彎)標志、標線的路口,紅燈期間或綠燈期間掉頭的;
    ??? (3)在黃色網格線內掉頭的。

    (二)有下列情形之一的,依法予以處罰:
    ?? (1)在設有禁止掉頭(禁止左轉彎)標志、標線的地點掉頭的;??? ?
    ?? (2)在人行橫道處掉頭的;
    ?? (3)在非禁止掉頭的地點掉頭與正常行駛的車輛、行人發生交通事故的,按掉頭時妨礙正常行駛的車輛通行或掉頭時妨礙正常行駛的行人通行的行為予以處罰。
    ?? (4)沒有從左側第一條車道(設置專用掉頭車道的除外)掉頭的,按掉頭時未按規定駛入最左側車道的行為進行處罰。


    posted @ 2009-05-29 00:46 Jcat 閱讀(234) | 評論 (0)編輯 收藏
    運行該Sub,所有單元格的字母都會變成大寫的
    Sub ?cap()
    Dim ?cell? As ?Range
    For ? Each ?cell?In?UsedRange
    ????cell.Value?
    = ? UCase $(cell.Value)
    Next
    End?Sub

    給定一段時間,計算出什么時候到期
    Sub ?deadline()
    ????
    Dim ?deadtime? As ? Date
    ????deadtime?
    = ? DateAdd ( " d " ,?Cells( 2 ,? 2 ),? Now )??????? ' day
    ????deadtime? = ? DateAdd ( " h " ,?Cells( 2 ,? 3 ),?deadtime)?? ' hour
    ????deadtime? = ? DateAdd ( " n " ,?Cells( 2 ,? 4 ),?deadtime)?? ' minute
    ????ActiveCell.Value? = ?deadtime
    End?Sub

    ' 選中右移
    ActiveCell.Value? = ? 123
    Cells(ActiveCell.Row,?ActiveCell.Column?
    + ? 1 ).Select
    ActiveCell.Value?
    = ? 456

    posted @ 2009-05-20 20:20 Jcat 閱讀(195) | 評論 (0)編輯 收藏
    登錄RMAN
    [oracle@dcm ~]$ rman target /
    Recovery Manager: Release 11.1.0.6.0 - Production on Wed May 13 13:25:30 2009
    Copyright (c) 1982, 2007, Oracle.? All rights reserved.
    connected to target database: O11G (DBID=140043054)
    ? 或
    [oracle@dcm ~]$ rman
    Recovery Manager: Release 11.1.0.6.0 - Production on Thu Jun 18 13:28:07 2009
    Copyright (c) 1982, 2007, Oracle.? All rights reserved.
    RMAN> connect target /
    connected to target database: O11G (DBID=140043054)



    因為數據庫是Open的,且又是非歸檔模式,所以無法進行在線全備份

    RMAN> backup database;
    ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode

    關了,整成mount狀態
    RMAN> shutdown
    database closed
    database dismounted
    Oracle instance shut down

    RMAN> startup mount
    connected to target database (not started)
    Oracle instance started
    database mounted



    開始數據庫全備份

    RMAN> backup database;
    Starting backup at 13-MAY-09
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=154 device type=DISK
    channel ORA_DISK_1: starting full datafile backup set
    channel ORA_DISK_1: specifying datafile(s) in backup set
    input datafile file number=00001 name=/u01/app/oracle/oradata/o11g/system01.dbf
    input datafile file number=00002 name=/u01/app/oracle/oradata/o11g/sysaux01.dbf
    input datafile file number=00005 name=/u01/app/oracle/oradata/o11g/example01.dbf
    input datafile file number=00003 name=/u01/app/oracle/oradata/o11g/undotbs01.dbf
    input datafile file number=00007 name=/u01/app/oracle/oradata/o11g/testspace2.dbf
    input datafile file number=00004 name=/u01/app/oracle/oradata/o11g/users01.dbf
    channel ORA_DISK_1: starting piece 1 at 13-MAY-09
    channel ORA_DISK_1: finished piece 1 at 13-MAY-09
    piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp tag=TAG20090513T153229 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
    channel ORA_DISK_1: starting full datafile backup set
    channel ORA_DISK_1: specifying datafile(s) in backup set
    input datafile file number=00006 name=/u01/app/oracle/oradata/o11g/testspace.dbf
    channel ORA_DISK_1: starting piece 1 at 13-MAY-09
    channel ORA_DISK_1: finished piece 1 at 13-MAY-09
    piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp tag=TAG20090513T153229 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
    Finished backup at 13-MAY-09

    Starting Control File and SPFILE Autobackup at 13-MAY-09
    piece handle=/home/oracle/myo11g/autobackup/c-140043054-20090513-00 comment=NONE
    Finished Control File and SPFILE Autobackup at 13-MAY-09

    查看備份信息
    RMAN> list backup of database;
    List of Backup Sets
    ===================
    BS Key? Type LV Size?????? Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    1?????? Full??? 1.15G????? DISK??????? 00:01:33???? 13-MAY-09???? ?
    ??????? BP Key: 1?? Status: AVAILABLE? Compressed: NO? Tag: TAG20090513T153229
    ??????? Piece Name: /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp
    ? List of Datafiles in backup set 1
    ? File LV Type Ckp SCN??? Ckp Time? Name
    ? ---- -- ---- ---------- --------- ----
    ? 1?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/system01.dbf
    ? 2?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/sysaux01.dbf
    ? 3?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/undotbs01.dbf
    ? 4?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/users01.dbf
    ? 5?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/example01.dbf
    ? 7?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/testspace2.dbf

    BS Key? Type LV Size?????? Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    2?????? Full??? 252.00K??? DISK??????? 00:00:07???? 13-MAY-09???? ?
    ??????? BP Key: 2?? Status: AVAILABLE? Compressed: NO? Tag: TAG20090513T153229
    ??????? Piece Name: /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp
    ? List of Datafiles in backup set 2
    ? File LV Type Ckp SCN??? Ckp Time? Name
    ? ---- -- ---- ---------- --------- ----
    ? 6?????? Full 1565621??? 13-MAY-09 /u01/app/oracle/oradata/o11g/testspace.dbf

    RMAN> list backup of controlfile;
    List of Backup Sets
    ===================
    BS Key? Type LV Size?????? Device Type Elapsed Time Completion Time
    ------- ---- -- ---------- ----------- ------------ ---------------
    3?????? Full??? 9.36M????? DISK??????? 00:00:08???? 13-MAY-09?????
    ??????? BP Key: 6?? Status: AVAILABLE? Compressed: NO? Tag: TAG20090513T161909
    ??????? Piece Name: /home/oracle/myo11g/autobackup/c-140043054-20090513-01
    ? Control File Included: Ckp SCN: 1568079????? Ckp time: 13-MAY-09



    刪除指定(BS Key)的備份集

    RMAN> delete backupset 1;
    using channel ORA_DISK_1
    List of Backup Pieces
    BP Key? BS Key? Pc# Cp# Status????? Device Type Piece Name
    ------- ------- --- --- ----------- ----------- ----------
    1?????? 1?????? 1?? 1?? AVAILABLE?? DISK??????? /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp

    Do you really want to delete the above objects (enter YES or NO)? YES
    deleted backup piece
    backup piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxwnqz_.bkp RECID=1 STAMP=686763156
    Deleted 1 objects

    刪除所有備份集
    RMAN> delete backup;

    using channel ORA_DISK_1

    List of Backup Pieces
    BP Key? BS Key? Pc# Cp# Status????? Device Type Piece Name
    ------- ------- --- --- ----------- ----------- ----------
    2?????? 2?????? 1?? 1?? AVAILABLE?? DISK??????? /u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp
    3?????? 3?????? 1?? 1?? AVAILABLE?? DISK??????? /home/oracle/myo11g/autobackup/c-140043054-20090513-00

    Do you really want to delete the above objects (enter YES or NO)? YES
    deleted backup piece
    backup piece handle=/u01/app/oracle/flash_recovery_area/O11G/backupset/2009_05_13/o1_mf_nnndf_TAG20090513T153229_50nxzv00_.bkp RECID=2 STAMP=686763258
    deleted backup piece
    backup piece handle=/home/oracle/myo11g/autobackup/c-140043054-20090513-00 RECID=3 STAMP=686763268
    Deleted 2 objects

    posted @ 2009-05-13 15:47 Jcat 閱讀(339) | 評論 (0)編輯 收藏
    01555
    ORA-01555: snapshot too old?? ?回滾段不夠用了
    可以采取的措施有:
    1、應用程序盡量避免巨表的漫長查詢操作,改傳統的cursor游標為bulk collect;
    2、盡量程序中不要使用大事務量的增刪改操作,同時記得及時commit;
    3、加大undo表空間和加大undo的retention。

    10046
    Event 10046是oracle用于系統性能分析時的一個最重要的事件。
    posted @ 2009-04-23 20:33 Jcat 閱讀(256) | 評論 (0)編輯 收藏
    Ora s le

    74億美元呀,現在Oracle可以和18摸全面抗衡了!

    簡直就成了IT屆的 GE vs 西門子!

    oracle-sun.JPG


    ----收購后的格局----
    航母級:IBM? vs? Oracle+SUN
    軟件:Microsoft,SAP,RedHat,Sybase(小賽的級別是不夠放在這的,我覺得它最終也會走上被收購的道路)
    硬件:HP,Dell,Fujitsu


    ----預測----
    1. MySQL是生是死?
    Oracle是當今企業級數據庫的老大,MySQL是當今互聯網應用的老大。
    如果小O把小My干掉,并不代表小My的那部分市場會成為小O的;相反,如果小O能好好照顧小My,那簡直就無敵了。
    個人預測:75分,只要小O能夠保持一顆開放的心,小My應該能有很好的發展。

    2. Solaris是生是死?
    小O一直致力于發展Linux技術(比如他和小紅合作搞的Unbreakable Linux),是把Solaris拿來當補充,還是干掉?
    個人預測:60分,不會有太大發展,保持現狀。

    3. Java的發展方向?
    Oracle在很多方面都很需要Java,這是好的一面。
    但是Java作為一門技術,而不是一個產品,需要有一個中立的代表,SUN以前的態度還是不錯的。但小O和小I顯然是誓不兩立的,會不會導致Java世界的分裂?
    個人預測:70分,這個可能最難預測,實在不希望看到不好的結果。

    4. 硬件部分
    這是小O沒有的,但是不排除小O把它剝離賣出去。但我又覺得這種可能性很小,因為小O最不缺的就是錢,而且這是小O去和小I叫板的一大資本。
    個人預測:80分,以后Oracle也可以玩total solution的游戲了。



    ----關系----
    ? 和IBM,這回真的成為死死對頭了
    ? 和HP、Dell,選什么產品還是由市場決定的,小O總不能強買強賣SUN的服務器吧,還好吧
    ? 和RedHat,小O和小紅正在一起搞過Unbreakable Linux,我覺得小O會繼續搞下去
    ? 和Sybase,這回搞得三大主流操作系統(Windows、AIX、Solaris)都有自己的數據庫了,Sybase的數據庫將越來越難賣了
    ? 和SAP,Microsoft,跟這次收購沒太大關系,但震撼一定不小
    posted @ 2009-04-21 10:27 Jcat 閱讀(241) | 評論 (0)編輯 收藏
    --最多同時運行的JOB個數;如果太小,JOB就排隊等待;如果為0,就沒有JOB會被執行。
    SQL> show parameter job_queue_processes
    NAME??????????????????????????????????????? TYPE????????? VALUE
    --------------------------???????? ----------??? -------------
    job_queue_processes???????? integer ?? ????? 10


    --一個什么也不做的SP

    CREATE OR REPLACE PROCEDURE mytest
    IS
    BEGIN
    ?? ?NULL;
    END;

    --一個往表里寫數據的SP
    CREATE OR REPLACE PROCEDURE mytest
    IS
    BEGIN
    ?? ?insert into test_table values(...);
    END;

    --定時調用SP,10秒(86400秒=1天)
    SQL> VARIABLE job_id NUMBER;
    SQL> BEGIN
    ?????????? -- :job_id中的冒號表示冒號后面的是變量,類似SQL Server的@
    ?????????? DBMS_JOB.SUBMIT(:job_id, 'mytest;', sysdate, 'sysdate + 10 / 86400') ;
    ?????????? COMMIT;? --記得一定要commit哦
    ?????????? END;

    --查看剛才生成的Job ID
    SQL> set serveroutput on
    SQL> execute dbms_output.put_line(:job_id)? --這里倒是不需要commit,直接execute就好了
    318

    --查看所有Job
    ?select * from user_jobs;

    --刪除Job
    SQL> BEGIN
    ?????????? DBMS_JOB.REMOVE(123); --123是Job ID
    ?????????? COMMIT;
    ?????????? END;


    如果Job由于某種原因未能成功運行,Oracle將重試16次,之后如果還未能成功運行,將被標記為Broken。



    http://www.tkk7.com/Jcat/archive/2009/12/17/306315.html
    從10g開始,DBMS_SCHEDULER 逐步會替換掉 DBMS_JOB

    DBMS_JOB has been around forever, and now it is deprecated. Although DBMS_JOB still exists in 10g and 11g, but only for backward compatibility. No new features are being added to dbms_job and you will likely quickly run into its limitations. Oracle recommends the use of DBMS_SCHEDULER in releases 10g and up. DBMS_SCHEDULER is a much more robust package and fully-featured than DBMS_JOB. To use the DBMS_SCHEDULER package a user must be granted the CREATE JOB privilege.

    After replace DBMS_JOB with DBMS_SCHEDULER for all jobs successful, the job_queue_processes parameter can now be set to zero.
    SQL&gt; alter system set job_queue_processes=0;

    posted @ 2009-04-16 15:42 Jcat 閱讀(775) | 評論 (0)編輯 收藏
    登錄? shell> mysql -u用戶名 -p密碼

    查看數據庫? mysql> show databases;
    至少會顯示出兩個數據庫mysql和test,這是系統自建的,供大家練習用。

    使用數據庫? mysql> use 數據庫名

    查看表? mysql> show tables;

    查看表結構? mysql> desc 表名;

    備份數據庫? shell> mysqldump -uroot -p密碼 數據庫名 > 備份的文件路徑
    posted @ 2009-03-27 22:33 Jcat 閱讀(293) | 評論 (0)編輯 收藏
    SunOS是Sun的操作系統最初叫法,SunOS主要是基于BSDUnix版本;
    SunOS 5.0開始,SUN的操作系統開發開始轉向System V Release 4,并且有了新的名字叫做Solaris2.0
    Solaris 2.6以后,SUN刪除了版本號中的"2,因此,SunOS 5.10就叫做Solaris 10

    最后"SunOS"這個詞被用做專指Solaris操作系統的內核;而Solaris被認為是由SunOS,圖形化的桌面計算環境, 以及它網絡增強部分組成。
    ?
      
    ---Solaris與Sunos的版本轉換---
    Solaris 10 = SunOS 5.10
    Solaris 9 = SunOS 5.9
    Solaris 8 = SunOS 5.8
    Solaris 7 = SunOS 5.7

    Solaris 2.6 = SunOS 5.6
    Solaris 2.5 = Sunos 5.5

      

    ------------------
    Solaris也有分服務器版和個人版,它們分別是:
    ?? 服務器版:sparc
    ?? 個人版:x86
    雖然Solaris在SPARC上擁有強大的處理能力和硬件支持,但是在Intel x86上性能卻未如人意。
    posted @ 2009-03-13 12:19 Jcat 閱讀(809) | 評論 (2)編輯 收藏
    為了跟老外聊天,裝了個Skype。后來發現可以用來打IP電話,超值!

    skype.JPG

    這東西很適合我們這些北漂專門用來給家里打長途:

    1. 地點固定,我都是周末的晚上在家往老家打電話,肯定是在電腦前的
    2. 因為Skype不分本地長途,用來打長途更體現優勢
    3. 通話時間長,我一般一周打一次,每次30分鐘左右,就更更體現優勢了


    不適合打本地電話:

    1. 撥打的地點都是不可預期的,總不能要電話了,還得把電腦打開、上網
    2. 上班的時候倒是都在電腦前,但可以用公司的座機嘛,免費的
    3. 省錢的優勢不明顯:移動2.5;固話2.2角(管前三分鐘),之后1.1



    Sample: 每月往家打100分鐘(一周一次,每次25分鐘)
    ?? Skype=100*0.075+3=10.5元
    ?? 手機9點前=100*0.35=35元
    ?? 手機9點后=100*0.22=22元

    posted @ 2009-02-27 13:52 Jcat 閱讀(369) | 評論 (0)編輯 收藏
    基金的買賣時間和大盤一樣,但是網上一般可以隨時下單;如果是閉盤時間下的單,就順延到下一個開盤日購買。

    今天看到的基金凈值,其實是昨天的值。
    今天購買的基金,其凈值明天才能看見。

    下午3點以前購買基金,算作今天購買;3點以后,算作明天購買,即凈值要在后天才能看見。

    基金管理費:一般為1%左右,每天根據資產總額提取,凈值是已經提取了管理費和托管費后的價格。

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

    基民首先要弄清楚“認購”與“申購”的區別。
    1. 認購是針對新基金而言的,這個時候所認購的基金并不產生份額凈值,成交價以1元面值為基準。
    2. 申購則指在基金成立后,投資者申請購買基金份額的行為。

    無論是認購還是申購,交易時間內投資者可以提交認/申購申請。
    投資者只有在交易日下午3點收盤之前提交申購請求才能在當日生效,并可能成功交易。

    一般來說,投資者在份額發售期內已經正式受理的認購申請不得撤銷。
    對于申購申請,投資者只有在當日 15:00前提交撤銷申請,才能予以撤銷。

    在基金申購的過程中,投資者面臨著一個“未知成交價”的交易風險,這是因為申購價格以當日的基金份額凈值為基準進行計算,而成交當日的基金份額凈值只能在下午3點收盤之后誕生,這個凈值一般會在下一個交易日開始之前公告。

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

    收購費率是有折扣的(根據不同的銀行),如易方達前端申購費率是0.8%,但是如果用廣發卡費率是0.3%,1w元能省50元呢。
    "優惠費率不按金額分檔,持有廣東發展銀行理財通卡的個人投資者的優惠認購費率或申購費率統一為0.3%。"-- From 易方達
    posted @ 2009-02-22 17:18 Jcat 閱讀(440) | 評論 (2)編輯 收藏
    Habit 1: Be Proactive
    Change starts from within, and highly effective people make the decision to improve their lives through the things that they can influence rather than by simply reacting to external forces.

    Habit 2: Begin with the End in Mind
    Develop a principle-centered personal mission statement. Extend the mission statement into long-term goals based on personal principles.

    Habit 3: Put First Things First
    Spend time doing what fits into your personal mission, observing the proper balance between production and building production capacity. Identify the key roles that you take on in life, and make time for each of them.

    Habit 4: Think Win/Win
    Seek agreements and relationships that are mutually beneficial. In cases where a "win/win" deal cannot be achieved, accept the fact that agreeing to make "no deal" may be the best alternative. In developing an organizational culture, be sure to reward win/win behavior among employees and avoid inadvertantly rewarding win/lose behavior.

    Habit 5: Seek First to Understand, Then to Be Understood
    First seek to understand the other person, and only then try to be understood. Stephen Covey presents this habit as the most important principle of interpersonal relations. Effective listening is not simply echoing what the other person has said through the lens of one's own experience. Rather, it is putting oneself in the perspective of the other person, listening empathically for both feeling and meaning.

    Habit 6: Synergize
    Through trustful communication, find ways to leverage individual differences to create a whole that is greater than the sum of the parts. Through mutual trust and understanding, one often can solve conflicts and find a better solution than would have been obtained through either person's own solution.

    Habit 7: Sharpen the Saw
    Take time out from production to build production capacity through personal renewal of the physical, mental, social/emotional, and spiritual dimensions. Maintain a balance among these dimensions.

    ?

    posted @ 2008-12-25 16:35 Jcat 閱讀(324) | 評論 (0)編輯 收藏
    很多時候,在我們進行數據庫操作時,比如drop user,drop table等,經常會遇到這樣的錯誤:
    ORA-00604: error occurred at recursive SQL level 1 .

    關于Recursive SQL錯誤:
    我們知道,當我們發出一條簡單的命令以后,Oracle數據庫要在后臺解析這條命令,并轉換為Oracle數據庫的一系列后臺操作,這些后臺操作統稱為遞歸SQL。
    比如create table這樣一條簡單的DDL命令,Oracle數據庫在后臺,實際上要把這個命令轉換為對于obj$,tab$,col$等底層表的插入操作。Oracle所作的工作可能比我們有時候想的要復雜的多.。

    所以對于這樣的提示,很多時候是沒有絲毫用處的。

    這時,我們需要更詳細的信息,sql_trace就是一個好辦法。
    sql_trace實際上就是Oracle內部事件10046的第一個級別,即level=1。通過event 10046, 我們可以得到詳細的數據庫會話的信息,每個會話究竟在干什么,在等什么。通過對這個事件的學習,我們可以深入的理解和調整Oracle。


    結合eygle的文章整理的,SQL Trace更詳細的用法請見原文


    ----------

    Event 10046是oracle用于系統性能分析時的一個最重要的事件。當激活這個事件后,將通知oracle kernel追蹤會話的相關即時信息,并寫入到相應trace文件中。這些有用的信息主要包括sql是如何進行解析,綁定變量的使用情況,話中發生的等待事件等。
    Trace文件將會存放在 user_dump_dest 所指向的目錄,如,C:\ent\oracle\admin\o10g01\udump

    Event 10046可分成不同的級別(level),分別追蹤記錄不同程度的有用信息。對于這些不同的級別,應當注意的是向下兼容的,即高一級的trace信息包含低于此級的所有信息。
    ??? level 1:跟蹤sql語句,包括解析、執行、提取、提交和回滾等。
    ??? level 4:包括變量的詳細信息
    ??? level 8:包括等待事件
    ??? level 12:包括綁定變量與等待事件
    其中,level 1相當于打開了sql_trace。

    在當前會話啟用event,可以利用alter session + 事件名稱 + level:
    SQL> alter session set event ‘10046 trace name context forever, level 12’;

    關閉當前會話的event:
    SQL> alter session set event ‘10046 trace name context off’;

    這里應當值得一提的是,TRACE將消耗相當的系統資源,因此我們在使用TRACE的時候應當慎重。對于正式的系統,應當只在必要的時候進行TRACE操作,并且應當及時關閉。
    posted @ 2008-12-19 15:19 Jcat 閱讀(256) | 評論 (0)編輯 收藏
    孫悅和菲爾.jpg
    湖人vs雄鹿,第四節垃圾時間,孫悅終于替補出場。

    孫悅失誤了隊友安慰他.jpg
    上來就3個犯規,1個運球失誤,顯得很緊張,身體僵硬。又失誤了,隊友安慰他。
    然后1個三分的機會,沒進,動作很僵硬。

    孫悅投進NBA第一球.jpg
    終于有個中距離的機會,孫悅投中了,全場鼓掌!
    后來又有一個反擊的機會,孫悅籃下打板進了,繼續鼓掌!


    恭賀菜鳥的第一次NBA亮相!
    posted @ 2008-12-08 13:07 Jcat 閱讀(295) | 評論 (1)編輯 收藏
    2008

    11-25 XX is a brilliant scientist.

    11-26 She used to knit her brows when meeting with a difficult problem.

    11-27 The tea bubbled in the pot.

    11-28 I budgeted for a daily expenditure of 15 dollars.

    11-29 The elephant lowered its huge bulk.

    11-30 She bumped her arm against the door.

    12-1 He has lost the bunch of keys and cannot unlock the door.

    12-2 We collected a bundle of old clothes to be given to them.

    12-3 He has found a job in the Washington Bureau of the Associated Press.

    12-4 Whenever I have to stand up to make a speech, I get butterflies in my stomach.

    12-5 How much does it cost for the first cabin.

    12-6 Put all these documents into a filing cabinet.

    12-7 The messages have come by cable.

    12-8 He has calculated the advantage and disadvantage before making the decision.

    12-9 The calendar shows that Christmas will fall on a Monday.

    12-10 He announced that he would campaign for the senate.

    12-11 The Princeton campus has developed into one of the most attractive school in the USA.

    終于還是沒堅持下來,看來堅持不懈做一件很小的事也是很難的。



    posted @ 2008-12-03 12:07 Jcat 閱讀(290) | 評論 (0)編輯 收藏
    Oracle Database的大版本號由兩部分組成:數字+字母,數字自然是大版本號,字母則是代表了這個版本的“中心思想”

    8i(1998),9i(2001):那時候正好互聯網興起,i就代表internet(網絡)

    10g(2003),11g(2007):現在主推分布式計算,g就代表grid(網格)



    另外,還有個11i,這容易引起混淆,其實11i是指Oracle EBS(E-Business Suite電子商務套件)的版本號,其實就是Oracle ERP。(這好像跟Oracle Database沒什么必然聯系,我也不知道這個i代表什么)

    這也說明Oracle不等于Oracle Database。平常我們說“Oracle”,一般都是指Oracle Database,當然這是它最著名的產品;不過,其實Oracle早就已經不是一家數據庫廠商了,而是航母級廠商,東收西購,啥都有了。


    我見過這樣的問題:“
    從版本命名來看8i-9i-10g-11i,是不是意味著grid只是曇花一現?”顯然這就是混淆了Oracle Database和Oracle ERP。



    ----以下是一些參考----
    In 1998, Oracle announced Oracle8i, which is sometimes referred to as Version 8.1 of the Oracle8 database. The i was added to denote added functionality supporting Internet deployment in the new version. Oracle9i followed, with Application Server available in 2000 and Database Server in 2001.

    Oracle Database 10g was introduced in 2003; the g denotes Oracle's focus on emerging grid deployment models.

    Oracle 11i refers to the Oracle ERP Application Suite (often called Oracle E-Business Suite) and really has nothing to do with the database. The latest release (12) will be referred to as 12i. The confusing part is that Oracle used to call its database "i" for "internet" in releases 8 and 9, but now calls the database "g" for "grid". So, to summarize, Oracle 11i refers to the apps and Oracle 11g refers to the database




    posted @ 2008-11-17 22:32 Jcat 閱讀(1342) | 評論 (1)編輯 收藏
    主站蜘蛛池模板: 四虎影视无码永久免费| 114级毛片免费观看| 在线永久看片免费的视频| 精品久久免费视频| 亚洲人成色777777在线观看| 亚洲国产超清无码专区| 免费国产va视频永久在线观看| 国偷自产一区二区免费视频| 岛国片在线免费观看| 亚洲VA中文字幕无码毛片| 学生妹亚洲一区二区| a级片免费观看视频| 人妻视频一区二区三区免费| 国产成人综合亚洲AV第一页| 亚洲激情视频图片| 青青操视频在线免费观看| 免费看国产成年无码AV片| 亚洲日韩精品射精日| 亚洲乱码av中文一区二区| 久久精品视频免费播放| 在线看片无码永久免费aⅴ| 亚洲视频精品在线| 日韩一区二区三区免费播放| 国拍在线精品视频免费观看| 亚洲精品中文字幕无码蜜桃| 精品亚洲视频在线| 最近免费视频中文字幕大全| 亚洲免费在线观看| 亚洲免费综合色在线视频| 99精品热线在线观看免费视频| 亚洲成A人片77777国产| 日韩亚洲产在线观看| 无码免费一区二区三区免费播放 | 亚洲一区二区三区深夜天堂| yy一级毛片免费视频| 免费观看男人免费桶女人视频| 亚洲韩国—中文字幕| 国产黄色片免费看| 国产乱子伦精品免费无码专区| 亚洲精品中文字幕麻豆| 你好老叔电影观看免费|