純好人不用打:白羊
沒人防:雙子(迷宮)、天平(卡妙的冰箱)、射手(迷宮)
打死:巨蟹(紫龍)、山羊(紫龍自曝)、雙魚(阿瞬)、水瓶(冰河)
沒打過,放水:獅子(星矢)、天蝎(冰河)、金牛(星矢)、處女(一輝)
這樣看來紫龍是最NB的,一個(gè)人干掉2個(gè),而且靠他師傅走后門天平不用打,還用天平的武器救了冰河。
冰河和他師傅干了2仗
冰河那段也挺NB,先是在天平被凍個(gè)半死,然后在天蝎被針扎個(gè)半死,最后到了水瓶還能把他師傅干掉
冰河和他師傅是最體現(xiàn)實(shí)力的一仗,純實(shí)力對扣
合著星矢誰也沒殺,就TM來打醬油的。。。
posted @
2011-10-21 14:29 Jcat 閱讀(562) |
評論 (1) |
編輯 收藏
簡單過一遍,詳細(xì)的以后遇到慢慢研究。
主要的更新在幾個(gè)方面:
1. OUI的改進(jìn)
2. Oracle Restart
3. ASM的增強(qiáng)!!!
New Grid Infrastructure Installation Option
?1. 單點(diǎn)包括:ASM、listener和Oracle Restart(監(jiān)控、管理并自動重啟各個(gè)組件)
?2. 集群包括:ASM、listener和Clusterware
New Desktop and Server Class Options?1. Desktop Class:適用于筆記本、臺式機(jī)
?2. Server Class:適用于服務(wù)器(功能上沒區(qū)別,多一些高級配置選項(xiàng))
Daylight Savings Time Upgrade of Timestamp with Timezone Data Type?新的DBMS_DST包,優(yōu)化對TIMESTAMP WITH TIMEZONE數(shù)據(jù)的管理
SYSASM Privilege?管理ASM需要SYSASM權(quán)限,旨在分清ASM管理和DB管理
Fixup Scripts and Prerequisite Checks?安裝前檢查時(shí),如果遇到不符合要求的配置,OUI會對一些檢查項(xiàng)自動生成fixup腳本,用root執(zhí)行就可以解決相應(yīng)問題。
New Tool to Configure Custom Installation Options?OUI不在提供對單個(gè)組件的配置功能,如果需要只能用$ORACLE_HOME/bin/chopt命令行進(jìn)行配置。
我想Oracle的趨勢就是為了讓更多已經(jīng)成熟的配置自動化,簡化使用。Deinstallation Tool?OUI不再用來刪除oracle軟件,請使用$ORACLE_HOME/deinstall
Intelligent Data Placement?指定ASM磁盤的磁盤范圍,旨在將高頻訪問的數(shù)據(jù)放在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. 針對單點(diǎn)環(huán)境
?2. 自動重啟又問題的組件,如:db instance、listener、asm instance
New Method of Installing Oracle Automatic Storage Management?以前,ASM的安裝是伴隨著DB的安裝;現(xiàn)在是伴隨著Software的安裝。
?其實(shí),就是把ASM上升到一個(gè)軟件的高度(以前只是db的一個(gè)組件)
SRVCTL Support for Single Instance Database in a Cluster?SRVCTL統(tǒng)一管理單點(diǎn)(with Restart)和集群數(shù)據(jù)庫(with Clusterware)
Deprecated in Oracle Database 11g Release 2?不支持裸設(shè)備了:要么用文件系統(tǒng)、要么用ASM,說白了,
企業(yè)環(huán)境就必須用ASM?不支持Oracle Ultra Search(9i的一個(gè)什么鳥功能)
posted @
2011-06-17 15:35 Jcat 閱讀(818) |
評論 (0) |
編輯 收藏
重裝完系統(tǒng),mysql不需要重裝,直接當(dāng)綠色版使用,還更干凈
//啟動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 mysqlDatabase 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
創(chuàng)建數(shù)據(jù)庫mysql> create database testdb;
posted @
2011-06-16 01:40 Jcat 閱讀(932) |
評論 (1) |
編輯 收藏
--主鍵是非分區(qū)索引,也可以看作是全局
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;
--主鍵是分區(qū)索引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;
這個(gè)案例也告訴我們,在做DDL時(shí),盡量還是顯示的寫出屬性,一些簡易語法會引起不可知的定義。最后都用 get_ddl 再查一下,這才是Oracle真正執(zhí)行的DDL。
posted @
2010-09-15 15:26 Jcat 閱讀(1285) |
評論 (0) |
編輯 收藏
列出所有實(shí)例
[db2inst1@dcm ~]$ db2ilist
db2inst1
列出當(dāng)前實(shí)例下的所有數(shù)據(jù)庫[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???????? =
啟動實(shí)例[db2inst1@dcm ~]$ db2start
07/09/2010 14:24:36???? 0?? 0?? SQL1063N? DB2START processing was successful.
SQL1063N? DB2START processing was successful.
連接到數(shù)據(jù)庫[db2inst1@dcm ~]$ db2 connect to sample
?? Database Connection Information
?Database server??????? = DB2/LINUX 9.7.1
?SQL authorization ID?? = DB2INST1
?Local database alias?? = SAMPLE
執(zhí)行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.
關(guān)閉實(shí)例[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,發(fā)現(xiàn)關(guān)于“數(shù)據(jù)庫”、“實(shí)例”的概念及其關(guān)系容易把人弄暈,這里小小總結(jié)一下,并把Oracle也拉進(jìn)來一起整。
另外,發(fā)現(xiàn)Oracle和IBM老搞一些理論上就針鋒相對的事情,如RAC vs DPF (database partitioning feature),很是有趣。
基本概念還是相同的
數(shù)據(jù)庫軟件(下面簡稱軟件):軟件本身,一臺主機(jī)安裝一套就可以了。(拋開你故意在一臺服務(wù)器上安裝2遍Oracle/DB2這種不正常思維)
實(shí)例:數(shù)據(jù)庫
軟件啟動后的“進(jìn)程+內(nèi)存”
軟件+實(shí)例的關(guān)系:一臺電腦只需要按照一套QQ(軟件),但是我們可以多用戶登錄(實(shí)例)。換到哲學(xué)的角度,就是抽象和具體的關(guān)系。
數(shù)據(jù)庫(狹義,下面簡稱庫):一堆文件(數(shù)據(jù)文件、控制文件、日志文件、參數(shù)文件)
它和軟件的區(qū)別:軟件是廠商賣給你的東西;
庫是你自己的東西(業(yè)務(wù)、應(yīng)用)
它和實(shí)例的關(guān)系:用戶需要借助實(shí)例(所提供的各種手段)來訪問
庫庫就相當(dāng)于是QQ聊天記錄
最后:數(shù)據(jù)庫(廣義)= 軟件 + 實(shí)例 + 庫一臺服務(wù)器(即一套數(shù)據(jù)庫軟件)可以建多個(gè)實(shí)例,多個(gè)庫,且互不相干
體系結(jié)構(gòu)的不同之處Oracle? 實(shí)例和庫一一對應(yīng)
DB2???? 一個(gè)實(shí)例可以掛多個(gè)庫
高級情況(簡單提一下,以后再慢慢研究)Oracle:RAC一個(gè)庫被多個(gè)實(shí)例掛
DB2:DPF一個(gè)實(shí)例多個(gè)庫
在數(shù)據(jù)庫集群模式設(shè)計(jì)方面,有Share everything架構(gòu)和Share nothing架構(gòu),前者以O(shè)RACLE RAC為代表,IBM DB2 Purescale為挑戰(zhàn)者;后者以IBM DB2 DPF為代表。
posted @
2010-07-08 18:26 Jcat 閱讀(426) |
評論 (0) |
編輯 收藏
行鏈接:
1. 一條記錄的大小大于block size,則產(chǎn)生行鏈接
2. 容易發(fā)生在比較大的行上
3. 因?yàn)樾墟溄邮怯蒬b_block_size不夠大引起的,所以對已有的行鏈接是無法清除的
4. 9i以后,可以對不同的表空間設(shè)置不同的db_block_size,可以將一些特殊的寬表放在大block size的表空間
例子:
表空間block size為8k(8192),因?yàn)閿?shù)據(jù)塊頭也要占一定空間,所以如下例,實(shí)際只能放7948的數(shù)據(jù),一旦超過,就產(chǎn)生行鏈接
--無
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. 因?yàn)楦率箁ow size變大了,一個(gè)block里又不足以放下增加的空間(PCTFREE相關(guān)),則產(chǎn)生行遷移
3. 容易發(fā)生在PCTFREE較小,對類似varchar類型的update又很多的表上
4. 無法避免,但通過把數(shù)據(jù)導(dǎo)出導(dǎo)入進(jìn)行清除
例子:
--無
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了,產(chǎn)生行遷移
--有
update test7948_vchar set e='123456789'
posted @
2010-06-13 14:08 Jcat 閱讀(235) |
評論 (0) |
編輯 收藏
隨著Oracle收購SUN,今天又爆出SAP收購Sybase的大料。
現(xiàn)狀:
Oracle和IBM已經(jīng)成為諾亞方舟級的廠商,啥都有。
微軟,SAP成為航母級的廠商,軟件方面啥都有,但目前沒有硬件。
猜想:who's next? Dell? HP?
不然微軟把Dell收了吧,組成BDll公司;
然后SAP和HP合并為SHP
posted @
2010-05-14 11:24 Jcat 閱讀(243) |
評論 (0) |
編輯 收藏
--創(chuàng)建一個(gè)大一點(diǎn)的TEMP表空間
create temporary tablespace temp1
tempfile '/oracledatafile/temp01.dbf' SIZE 100m autoextend on next 100m maxsize 5000m;
?
--切換默認(rèn)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. 物化視圖由于是物理真實(shí)存在的,故可以創(chuàng)建索引。
--為基表創(chuàng)建MLOG
--創(chuàng)建物化視圖時(shí)應(yīng)先創(chuàng)建存儲的日志空間,否則建MV時(shí)報(bào)錯(cuò)
--ORA-23413: table "SCOTT"."EMP" does not have a materialized view log
create materialized view log on
scott.emptablespace test
/
--創(chuàng)建物化視圖create materialized view test_mv
tablespace test
parallel (degree 4)
build immediate refresh fast
enable query rewrite
as
select * from
scott.emp/
--查看一下結(jié)果,果然很符合物化視圖的定義,一個(gè)表+一個(gè)視圖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?
(這就是那個(gè)存儲表)--查看MLOG的情況--注意:MLOG的所屬和MV的所屬并不是同一個(gè)SQL> select log_owner, master, log_table from dba_mview_logs
LOG_OWNER??? MASTER??? LOG_TABLE
---------------------------------
SCOTT??? ??? EMP??? MLOG$_EMP
(MLOG其實(shí)也就是一個(gè)表)SQL> desc scott.
mlog$_emp;
Name??? ??? ??? Type
-------------------------------
EMPNO??? ??? ??? NUMBER(4)
SNAPTIME$$??? ??? DATE
DMLTYPE$$??? ??? VARCHAR2(1)
OLD_NEW$$??? ??? VARCHAR2(1)
CHANGE_VECTOR$$??? ??? RAW(255)
--刪除MLOGdrop 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觸發(fā)器-----
1) 插入的一行新數(shù)據(jù)保存在:new
2) insert觸發(fā)器沒有:old值3) 對:new的修改,只能定義在before類型的觸發(fā)器中---觸發(fā)器語法---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(由觸發(fā)器生成的值)???????? 2????????? 3
-----DDL觸發(fā)器-----
--任何create語句都會觸發(fā)這個(gè)語句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中自動就帶有如下內(nèi)容,這里咱們就來解釋一下這些東西是干什么用的
----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 CommunicationWhen 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默認(rèn)安裝時(shí),會安裝一個(gè)PL/SQL外部程序(
extproc--這是程序名)條目在listener.ora中,是oracle為調(diào)用外部程序默認(rèn)配置的監(jiān)聽,它的名字(也就是SID)通常是ExtProc或
PLSExtProc。
但一般不會使用它,可以直接從listener.ora中將這項(xiàng)移除,因?yàn)閷xtProc已經(jīng)有多種攻擊手段了,在不使用外部程序時(shí),Oracle也是建議刪除的。
extproc的作用就是在pl/sql中調(diào)用
外部語句,如c,java寫的過程。
現(xiàn)在,Oracle已經(jīng)全面支持JAVA了,這東西也就過時(shí)了,之所以繼續(xù)保留是考慮到兼容以前老版本的數(shù)據(jù)庫實(shí)例。
[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用戶,創(chuàng)建一個(gè)測試用戶,權(quán)限可以給大點(diǎn)
SQL> create user test identified by xxxxx;
SQL> grant connect to test;
SQL> grant resource to test;
SQL> grant dba to test;
--登錄test用戶,開始測試--建個(gè)測試表create table test_table(id int, time timestamp);
--創(chuàng)建Jobbegin
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函數(shù)同SQLServer的isnull函數(shù)?? ?start_date => null,
--一激活,就開始?? ?repeat_interval => '
FREQ=SECONDLY;INTERVAL=10');
end;
FREQ用來指定間隔的時(shí)間周期,可選參數(shù)有:YEARLY,MONTHLY,WEEKLY,DAILY,HOURLY,MINUTELY,SECONDLY。--光創(chuàng)建沒用,還需要激活;也可以在創(chuàng)建時(shí),直接把enable屬性設(shè)置為true(enabled => true)select job_name, enabled, run_count from user_scheduler_jobs;
JOB_NAME?????????????????????? ENABL? RUN_COUNT
------------------------------ ----- ----------
TEST_JOB?????????????????????? FALSE????????? 0begin
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--停止任務(wù)begin
dbms_scheduler.disable('test_job');
end;
--刪除任務(wù)begin
dbms_scheduler.drop_job('test_job');
end;
posted @
2009-12-17 16:13 Jcat 閱讀(247) |
評論 (0) |
編輯 收藏
一致和并發(fā)是對立的,需要根據(jù)應(yīng)用,選擇權(quán)宜之計(jì)
數(shù)據(jù)不一致的現(xiàn)象
---事務(wù)內(nèi)單SQL的情況---
1.
臟讀-Dirty Read:本事務(wù)讀取了其它事務(wù)尚未提交的修改數(shù)據(jù)
例子:讀了不該讀的
1:00 x=1
1:01 A用戶 Update x=2(但未commit)
1:02 B用戶 Select x --> x=2
合理的情況是x仍然等于1---事務(wù)內(nèi)多SQL的情況(典型的如,先查再改)---2.
不可重復(fù)讀-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
首先這個(gè)結(jié)果從單條SQL的角度看,是沒有問題的。但是,如果把B的兩次查詢看作一個(gè)整體(事務(wù)),那么合理的情況應(yīng)該是
? x+y仍然等于3
? 或者B再進(jìn)行一次事務(wù),得出 x=2 y=2 x+y=4 的結(jié)果例子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 33.
幻影讀-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
其實(shí)道理和之前的不可重復(fù)讀相同,只不過是由Insert引起的罷了。
(甚至Delete也會引起類似的問題,但好像學(xué)術(shù)界并沒有對Delete進(jìn)行討論)Isolation LevelRead Uncommitted:1,2,3都會發(fā)生
? Oracle中嚴(yán)格禁止臟讀
? 在SQL Server 7.0中,是可以選擇該級別的
Read Committed:發(fā)生2,3(Oracle的默認(rèn)級別)
Repeatable Read:發(fā)生3
Serializable:都不發(fā)生
Oracle的實(shí)現(xiàn)方式Read Committed:默認(rèn)就實(shí)現(xiàn)
Repeatable Read:
? 1. 悲觀鎖(select ... for update),影響并發(fā)
? 2. 樂觀鎖(update where 所有字段都作為條件),不影響并發(fā)
Serializable:
? alter session set isolation_level=serializable/read only
posted @
2009-12-05 17:45 Jcat 閱讀(218) |
評論 (0) |
編輯 收藏
因?yàn)樵诳蛻裟枪ぷ鞑荒苌暇W(wǎng),決定辦一張3G上網(wǎng)卡(公司報(bào)銷),中午分別去電信和移動了解了一下:
電信 960元? 7個(gè)月? 300小時(shí)/月
移動 880元? 7個(gè)月? 15G/月 (目前推廣期,不限流量)
(都包含上網(wǎng)貓)
這樣算下來還是移動的便宜,去搞了個(gè)移動的。
關(guān)于移動的上網(wǎng)貓,開始給我測試的時(shí)候用的是華為的、白色、流線型還挺好看。最終給我的是一個(gè)鳥公司的(敏訊),方形真難看,太大了,號稱還是升級版。
速度嘛,看網(wǎng)頁沒啥問題,Outlook下郵件也很快,在線聽歌也沒問題,在線電影就不去嘗試了,免得傷自尊,辦公足夠了。玩開心網(wǎng)有點(diǎn)卡。(我以前就用過聯(lián)通的CDMA-2G上網(wǎng),那叫一個(gè)慢呀)
這個(gè)帖子就是用3G網(wǎng)絡(luò)發(fā)的,哈哈。同時(shí)紀(jì)念一下2年后重回BMW做項(xiàng)目。
posted @
2009-09-17 19:09 Jcat 閱讀(233) |
評論 (0) |
編輯 收藏
扇區(qū)(sector):最小的可尋址單元,512byte
磁道(track):一圈扇區(qū)
磁柱(cylinder):一摞磁道
每一磁道的扇區(qū)數(shù)是一樣的,但是存儲密度不同,外疏內(nèi)密。
為什么要外疏內(nèi)密?
角速度相同時(shí),線速度與半徑成正比:
硬盤為了提高其軸壽命,軸的轉(zhuǎn)動速度是一定的。磁頭在硬盤上讀寫數(shù)據(jù)是近乎于圓弧的路線,而越往外,線速度就越快。為了保證讀取的準(zhǔn)確性只能減小外道的密度使磁頭讀取數(shù)據(jù)的時(shí)間間隔是相同的。
有待研究:早期的磁盤每個(gè)磁道上的扇區(qū)數(shù)目是一樣,顯然浪費(fèi)了外圈的容量,后來為了增大磁盤容量采用了新技術(shù),也就是說越往外每磁道扇區(qū)數(shù)目越多。
posted @
2009-09-14 15:50 Jcat 閱讀(382) |
評論 (0) |
編輯 收藏
字符設(shè)備:按照字符流的方式被有序訪問,不能隨機(jī)存取,如鍵盤、串口打印機(jī)、磁帶。
塊設(shè)備:能夠隨機(jī)(不需要按順序)訪問固定大小數(shù)據(jù)片(chunks),采用塊緩沖技術(shù),如硬盤、軟盤、光驅(qū)。
裸設(shè)備:是一種沒有經(jīng)過格式化,不被Unix通過文件系統(tǒng)來讀取的特殊字符設(shè)備。
現(xiàn)在問題來了,Oracle在使用裸設(shè)備時(shí)(如ASM、甚或表空間直接建在裸設(shè)備上),難道還是順序存取?顯然不符合事實(shí)。
其實(shí),說裸設(shè)備是字符設(shè)備,只是從操作系統(tǒng)的角度來說的;從使用裸設(shè)備的應(yīng)用程序(如Oracle)的角度,還是塊設(shè)備,Oracle會去對磁盤進(jìn)行分塊管理。
邏輯卷是邏輯概念,可以包含多塊物理硬盤,實(shí)現(xiàn)了存儲跨盤功能,同時(shí)提供了數(shù)據(jù)復(fù)制機(jī)制,提供了數(shù)據(jù)安全保護(hù)機(jī)制。
--------------
裸設(shè)備適用于每次改動數(shù)據(jù)較小、需大量并發(fā)交易,OLTP;
對于大規(guī)模順序讀寫,裸設(shè)備性能是最差的,所以對OLAP,應(yīng)使用塊設(shè)備或卷。
posted @
2009-09-14 13:45 Jcat 閱讀(598) |
評論 (0) |
編輯 收藏
--創(chuàng)建一個(gè)分區(qū)表
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) ?
)
--插入一些數(shù)據(jù)(順便實(shí)踐一下雙層循環(huán))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(luò)循環(huán)里面了?? ???? END LOOP;
END;
--需要先進(jìn)行分析,否則num_rows列將為空analyze table scott.testpart compute statistics;
--查看各個(gè)分區(qū)的情況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因?yàn)榧恿艘柸匀皇切懀ǖ⒉伙@示引號,這點(diǎn)比較討厭),沒加引號的會顯示為大寫--驗(yàn)證數(shù)據(jù)確實(shí)進(jìn)入了正確的分區(qū)select * from scott.testpart partition(p1);
TEXTDATE
--------
20090101
20090102
20090103
--創(chuàng)建p2時(shí)有引號,使用p2時(shí)也就需要引號。--特別的,用一些第三方客戶端創(chuàng)建分區(qū)表時(shí),生成的SQL往往會自動加上引號,而查看DBA_TAB_PARTITIONS時(shí)又看不出來,所以遇到下面的問題,可以加個(gè)引號試試。select * from scott.testpart partition(p2);
ERROR at line 1:
ORA-02149: Specified partition
does not existselect * from scott.testpart partition(
"p2");
TEXTDATE
--------
20090201
20090202
20090203
--其它相關(guān)select * from scott.testpart;
truncate table scott.testpart;
drop table scott.testpart;
posted @
2009-08-18 18:17 Jcat 閱讀(264) |
評論 (0) |
編輯 收藏
股票的面值,是股份公司在所發(fā)行的股票票面上標(biāo)明的票面金額,它以元/股為單位,其作用是用來表明每一張股票所包含的資本數(shù)額。
在我國上海和深圳證券交易所流通的股票的面值均為壹元,即每股一元。一般來說,股票的發(fā)行價(jià)格都會高于其面值。當(dāng)股票進(jìn)入流通市場后,股票的面值就與股票的價(jià)格沒有什么關(guān)系了。股民愛將股價(jià)炒到多高,它就有多高。
按股東權(quán)利分類,股票可分為普通股、優(yōu)先股和后配股。
在我國上交所與深交所上市的股票都是普通股。
股息紅利作為股東的投資收益,是以股份為單位計(jì)算的貨幣金額,如每股多少元。但在上市公司實(shí)施具體分派時(shí),其形式可以有四種:這就是現(xiàn)金股利、財(cái)產(chǎn)股利、負(fù)債股利和股票股利等。
滬深股市的上市公司進(jìn)行利潤分配一般只采用股票紅利和現(xiàn)金紅利兩種,即統(tǒng)稱所說的送紅股和派現(xiàn)金。
當(dāng)上市公司向股東分派股息時(shí),就要對股票進(jìn)行除息;當(dāng)上市公司向股東送紅股時(shí),就要對股票進(jìn)行除權(quán)。
我國上市公司中約有一半以上的股份為國家股,且其股權(quán)代表基本上都是上市公司的經(jīng)營管理人員。由于切身利益的影響,經(jīng)營管理人員基本上都贊同企業(yè)的發(fā)展與擴(kuò)張,所以我國上市公司的分紅中,送紅股的現(xiàn)象就非常普遍。
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
鏈接數(shù)只是和硬鏈接相關(guān)的一個(gè)概念
從鏈接文件可以跟蹤到軟鏈接的指向(無法反向跟蹤)
---------------
由于inode這種文件系統(tǒng)結(jié)構(gòu)不是雙向的,不能查找一個(gè)inode被reference了多少次。我們只能通過一些技巧來跟蹤硬鏈接。
1. 通過鏈接數(shù),我們可以知道哪個(gè)文件有硬鏈接(大于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. 硬鏈接本質(zhì)上是多個(gè)dentry指向同一個(gè)inode,所以并沒有主從之分,每個(gè)dentry都是平等的。
posted @
2009-07-14 17:40 Jcat 閱讀(258) |
評論 (0) |
編輯 收藏
--修改后重新啟動數(shù)據(jù)庫,永久生效
SQL> alter system set nls_date_format='yyyymmdd';
ERROR at line 1:
--不能是memory scope(默認(rèn)是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?
--這個(gè)時(shí)候還沒生效NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
nls_date_format????????????????????? string
--重啟數(shù)據(jù)庫后SQL> show parameter nls_date_format
NAME???????????????????????????????? TYPE??????? VALUE
------------------------------------ ----------- ------------------------------
nls_date_format????????????????????? string????? yyyymmdd
SQL> select sysdate from dual;
SYSDATE
--------
20090627
--只對當(dāng)前session有效,重登錄一次SQLPLUS,效果就消失了SQL> alter session set nls_date_format='yyyy-mm-dd';??
--這個(gè)格式也很常用 yyyy-mm-dd hh:mi:ssSession altered.?
--同時(shí)會覆蓋初始化參數(shù)里的設(shè)置SQL> select sysdate from dual;
SYSDATE
----------
2009-06-27
posted @
2009-06-27 16:18 Jcat 閱讀(683) |
評論 (0) |
編輯 收藏
Oracle所有對象的相關(guān)信息都可以通過
靜態(tài)數(shù)據(jù)字典來查找,但數(shù)據(jù)字典實(shí)在太多,也記不清名字。
因?yàn)閿?shù)據(jù)字典都是以
DBA_開頭的
視圖,所以可以想辦法先把它們列出來。
btw,DBA>ALL>User以下兩句結(jié)果上是等效的
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 '\';
例子:
我想查看數(shù)據(jù)文件的相關(guān)信息,但是從DBA_DATA_FILES里,并沒有看見Temp表空間的數(shù)據(jù)文件的信息。
于是可以嘗試如下搜索:
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???
--找到嫌疑犯,進(jìn)去一看,果然記錄的是關(guān)于Temp表空間的數(shù)據(jù)文件的信息DBA_TEMP_FREE_SPACE

列一些常用的在這吧
有趣的時(shí),絕大多數(shù)數(shù)據(jù)字典都是復(fù)數(shù)單詞,一般從單詞上也都能猜出該視圖的作用:
dba_users?????數(shù)據(jù)庫用戶信息
dba_segments??表段信息
dba_extents????數(shù)據(jù)區(qū)信息
dba_objects????數(shù)據(jù)庫對象信息
dba_tablespaces???數(shù)據(jù)庫表空間信息
dba_data_files????數(shù)據(jù)文件設(shè)置信息
dba_temp_files???臨時(shí)數(shù)據(jù)文件信息
dba_rollback_segs???回滾段信息
dba_ts_quotas???用戶表空間配額信息
dba_free_space??數(shù)據(jù)庫空閑空間信息
dba_profiles???數(shù)據(jù)庫用戶資源限制信息
dba_sys_privs???用戶的系統(tǒng)權(quán)限信息
dba_tab_privs??用戶具有的對象權(quán)限信息
dba_col_privs??用戶具有的列對象權(quán)限信息
dba_role_privs??用戶具有的角色信息
dba_audit_trail??審計(jì)跟蹤記錄信息
dba_stmt_audit_opts??審計(jì)設(shè)置信息
dba_audit_object???對象審計(jì)結(jié)果信息
dba_audit_session??會話審計(jì)結(jié)果信息
dba_indexes??用戶模式的索引信息
posted @
2009-06-18 22:42 Jcat 閱讀(301) |
評論 (0) |
編輯 收藏
這兩個(gè)命令都是用來更改一些數(shù)據(jù)庫配置的,所以經(jīng)常容易混淆,如:
>alter database drop logfile group 1;
>alter system switch logfile;
>alter system kill session 'sid,serial#';
為了方便記憶,歸納如下:
alter database (改變數(shù)據(jù)庫--database)
和物理文件直接相關(guān)的操作
alter system (改變實(shí)例--instance)
不直接牽涉到磁盤文件的操作當(dāng)然,這只是為了方便記憶,只滿足大部分的情況,并不是所有的命令都能套到這個(gè)框框里,最終還是用熟了就記住哪個(gè)是哪個(gè)了。---外傳---
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) |
編輯 收藏
《道路交通安全法實(shí)施條例》第四十九條規(guī)定,機(jī)動車在有禁止掉頭或者禁止左轉(zhuǎn)彎標(biāo)志、標(biāo)線的地點(diǎn)以及在鐵路道口、人行橫道、橋梁、急彎、陡坡、隧道或者容易發(fā)生危險(xiǎn)的路段,不得掉頭;機(jī)動車在沒有禁止掉頭或者沒有禁止左轉(zhuǎn)彎標(biāo)志、標(biāo)線的地點(diǎn)可以掉頭,但不得妨礙正常行駛的其他車輛和行人的通行。在允許掉頭的地點(diǎn)設(shè)有掉頭專用信號燈的,應(yīng)當(dāng)在綠燈期間掉頭;未設(shè)有掉頭信號燈的,但有相應(yīng)的標(biāo)志標(biāo)明在紅燈或者綠燈期間掉頭的,應(yīng)當(dāng)按照標(biāo)志的指示掉頭;既無掉頭專用信號燈,又無其他標(biāo)志指示的,掉頭時(shí)可不受信號燈限制,但掉頭時(shí)不得妨礙正常行駛的車輛和行人通行。
-----
有下列情形之一的,依法予以處罰:
?? (1)在設(shè)有禁止掉頭(禁止左轉(zhuǎn)彎)標(biāo)志、標(biāo)線的地點(diǎn)掉頭的;??? ?
?? (2)在人行橫道處掉頭的;
?? (3)在非禁止掉頭的地點(diǎn)掉頭與正常行駛的車輛、行人發(fā)生交通事故的,按掉頭時(shí)妨礙正常行駛的車輛通行或掉頭時(shí)妨礙正常行駛的行人通行的行為予以處罰。
?? (4)沒有從左側(cè)第一條車道(設(shè)置專用掉頭車道的除外)掉頭的,按掉頭時(shí)未按規(guī)定駛?cè)胱钭髠?cè)車道的行為進(jìn)行處罰。
-----
(一)下列情形,不屬于違法行為:
??? (1)在沒有禁止掉頭(禁止左轉(zhuǎn)彎)標(biāo)志、標(biāo)線的地點(diǎn)掉頭的;
??? (2)
在沒有禁止掉頭(禁止左轉(zhuǎn)彎)標(biāo)志、標(biāo)線的路口,紅燈期間或綠燈期間掉頭的;??? (3)
在黃色網(wǎng)格線內(nèi)掉頭的。(二)有下列情形之一的,依法予以處罰:
?? (1)在設(shè)有禁止掉頭(禁止左轉(zhuǎn)彎)標(biāo)志、標(biāo)線的地點(diǎn)掉頭的;??? ?
?? (2)
在人行橫道處掉頭的;
?? (3)在非禁止掉頭的地點(diǎn)掉頭與正常行駛的車輛、行人發(fā)生交通事故的,按掉頭時(shí)妨礙正常行駛的車輛通行或掉頭時(shí)妨礙正常行駛的行人通行的行為予以處罰。
?? (4)
沒有從左側(cè)第一條車道(設(shè)置專用掉頭車道的除外)掉頭的,按掉頭時(shí)未按規(guī)定駛?cè)胱钭髠?cè)車道的行為進(jìn)行處罰。
posted @
2009-05-29 00:46 Jcat 閱讀(234) |
評論 (0) |
編輯 收藏
運(yùn)行該Sub,所有單元格的字母都會變成大寫的
Sub
?cap()
Dim
?cell?
As
?Range
For
?
Each
?cell?In?UsedRange
????cell.Value?
=
?
UCase
$(cell.Value)
Next
End?Sub
給定一段時(shí)間,計(jì)算出什么時(shí)候到期
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 ~]$ rmanRecovery 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)
因?yàn)閿?shù)據(jù)庫是Open的,且又是非歸檔模式,所以無法進(jìn)行在線全備份RMAN> backup database;ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
關(guān)了,整成mount狀態(tài)RMAN> shutdowndatabase closed
database dismounted
Oracle instance shut down
RMAN> startup mountconnected to target database (not started)
Oracle instance started
database mounted
開始數(shù)據(jù)庫全備份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)?
YESdeleted 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、應(yīng)用程序盡量避免巨表的漫長查詢操作,改傳統(tǒng)的cursor游標(biāo)為bulk collect;
2、盡量程序中不要使用大事務(wù)量的增刪改操作,同時(shí)記得及時(shí)commit;
3、加大undo表空間和加大undo的retention。
10046
Event 10046是oracle用于系統(tǒng)性能分析時(shí)的一個(gè)最重要的事件。
posted @
2009-04-23 20:33 Jcat 閱讀(256) |
評論 (0) |
編輯 收藏
Ora
s
le
74億美元呀,現(xiàn)在Oracle可以和18摸全面抗衡了!
簡直就成了IT屆的 GE vs 西門子!

----收購后的格局----
航母級:IBM? vs? Oracle+SUN
軟件:Microsoft,SAP,RedHat,Sybase(小賽的級別是不夠放在這的,我覺得它最終也會走上被收購的道路)
硬件:HP,Dell,F(xiàn)ujitsu
----預(yù)測----
1. MySQL是生是死?
Oracle是當(dāng)今企業(yè)級數(shù)據(jù)庫的老大,MySQL是當(dāng)今互聯(lián)網(wǎng)應(yīng)用的老大。
如果小O把小My干掉,并不代表小My的那部分市場會成為小O的;相反,如果小O能好好照顧小My,那簡直就無敵了。
個(gè)人預(yù)測:75分,只要小O能夠保持一顆開放的心,小My應(yīng)該能有很好的發(fā)展。
2. Solaris是生是死?
小O一直致力于發(fā)展Linux技術(shù)(比如他和小紅合作搞的Unbreakable Linux),是把Solaris拿來當(dāng)補(bǔ)充,還是干掉?
個(gè)人預(yù)測:60分,不會有太大發(fā)展,保持現(xiàn)狀。
3. Java的發(fā)展方向?
Oracle在很多方面都很需要Java,這是好的一面。
但是Java作為一門技術(shù),而不是一個(gè)產(chǎn)品,需要有一個(gè)中立的代表,SUN以前的態(tài)度還是不錯(cuò)的。但小O和小I顯然是誓不兩立的,會不會導(dǎo)致Java世界的分裂?
個(gè)人預(yù)測:70分,這個(gè)可能最難預(yù)測,實(shí)在不希望看到不好的結(jié)果。
4. 硬件部分
這是小O沒有的,但是不排除小O把它剝離賣出去。但我又覺得這種可能性很小,因?yàn)樾最不缺的就是錢,而且這是小O去和小I叫板的一大資本。
個(gè)人預(yù)測:80分,以后Oracle也可以玩total solution的游戲了。
----關(guān)系----
? 和IBM,這回真的成為死死對頭了
? 和HP、Dell,選什么產(chǎn)品還是由市場決定的,小O總不能強(qiáng)買強(qiáng)賣SUN的服務(wù)器吧,還好吧
? 和RedHat,小O和小紅正在一起搞過Unbreakable Linux,我覺得小O會繼續(xù)搞下去
? 和Sybase,這回搞得三大主流操作系統(tǒng)(Windows、AIX、Solaris)都有自己的數(shù)據(jù)庫了,Sybase的數(shù)據(jù)庫將越來越難賣了
? 和SAP,Microsoft,跟這次收購沒太大關(guān)系,但震撼一定不小
posted @
2009-04-21 10:27 Jcat 閱讀(241) |
評論 (0) |
編輯 收藏
--最多同時(shí)運(yùn)行的JOB個(gè)數(shù);如果太小,JOB就排隊(duì)等待;如果為0,就沒有JOB會被執(zhí)行。
SQL> show parameter job_queue_processes
NAME??????????????????????????????????????? TYPE????????? VALUE
--------------------------???????? ----------??? -------------
job_queue_processes???????? integer ?? ????? 10
--一個(gè)什么也不做的SP
CREATE OR REPLACE PROCEDURE mytest
IS
BEGIN
?? ?NULL;
END;
--一個(gè)往表里寫數(shù)據(jù)的SPCREATE OR REPLACE PROCEDURE mytest
IS
BEGIN
?? ?insert into test_table values(...);
END;
--定時(shí)調(diào)用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 IDSQL> set serveroutput on
SQL> execute dbms_output.put_line(:job_id)?
--這里倒是不需要commit,直接execute就好了318--查看所有Job?select * from user_jobs;
--刪除JobSQL> BEGIN
?????????? DBMS_JOB.REMOVE(123); --123是Job ID
?????????? COMMIT;
?????????? END;
如果Job由于某種原因未能成功運(yùn)行,Oracle將重試16次,之后如果還未能成功運(yùn)行,將被標(biāo)記為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> alter system set job_queue_processes=0;
posted @
2009-04-16 15:42 Jcat 閱讀(775) |
評論 (0) |
編輯 收藏
登錄? shell> mysql -u用戶名 -p密碼
查看數(shù)據(jù)庫? mysql> show databases;
至少會顯示出兩個(gè)數(shù)據(jù)庫mysql和test,這是系統(tǒng)自建的,供大家練習(xí)用。使用數(shù)據(jù)庫? mysql> use 數(shù)據(jù)庫名
查看表? mysql> show tables;
查看表結(jié)構(gòu)? mysql> desc 表名;
備份數(shù)據(jù)庫? shell> mysqldump -uroot -p密碼 數(shù)據(jù)庫名 > 備份的文件路徑
posted @
2009-03-27 22:33 Jcat 閱讀(293) |
評論 (0) |
編輯 收藏
SunOS是Sun的操作系統(tǒng)最初叫法,SunOS主要是基于BSDUnix版本;
SunOS
5.0開始,SUN的操作系統(tǒng)開發(fā)開始轉(zhuǎn)向System V Release 4,并且有了新的名字叫做
Solaris2.0;
Solaris
2.6以后,SUN刪除了版本號中的"2,因此,SunOS 5.10就叫做
Solaris 10。
最后"SunOS"這個(gè)詞被用做專指Solaris操作系統(tǒng)的內(nèi)核;而Solaris被認(rèn)為是由SunOS,圖形化的桌面計(jì)算環(huán)境,
以及它網(wǎng)絡(luò)增強(qiáng)部分組成。
?
---Solaris與Sunos的版本轉(zhuǎn)換---
Solaris 10 = SunOS 5.10
Solaris 9 = SunOS 5.9
Solaris 8 = SunOS 5.8
Solaris 7 = SunOS 5.7Solaris 2.6 = SunOS 5.6
Solaris 2.5 = Sunos 5.5
------------------
Solaris也有分服務(wù)器版和個(gè)人版,它們分別是:
??
服務(wù)器版:sparc
??
個(gè)人版:x86
雖然Solaris在SPARC上擁有強(qiáng)大的處理能力和硬件支持,但是在Intel x86上性能卻未如人意。
posted @
2009-03-13 12:19 Jcat 閱讀(809) |
評論 (2) |
編輯 收藏
為了跟老外聊天,裝了個(gè)Skype。后來發(fā)現(xiàn)可以用來打IP電話,超值!
這東西很適合我們這些北漂專門用來給家里打長途:
1. 地點(diǎn)固定,我都是周末的晚上在家往老家打電話,肯定是在電腦前的
2. 因?yàn)镾kype不分本地長途,用來打長途更體現(xiàn)優(yōu)勢
3. 通話時(shí)間長,我一般一周打一次,每次30分鐘左右,就更更體現(xiàn)優(yōu)勢了
不適合打本地電話:
1. 撥打的地點(diǎn)都是不可預(yù)期的,總不能要電話了,還得把電腦打開、上網(wǎng)
2. 上班的時(shí)候倒是都在電腦前,但可以用公司的座機(jī)嘛,免費(fèi)的
3. 省錢的優(yōu)勢不明顯:移動2.5;固話2.2角(管前三分鐘),之后1.1
Sample: 每月往家打100分鐘(一周一次,每次25分鐘)
?? Skype=100*0.075+3=10.5元
?? 手機(jī)9點(diǎn)前=100*0.35=35元
?? 手機(jī)9點(diǎn)后=100*0.22=22元
posted @
2009-02-27 13:52 Jcat 閱讀(369) |
評論 (0) |
編輯 收藏
基金的買賣時(shí)間和大盤一樣,但是網(wǎng)上一般可以隨時(shí)下單;如果是閉盤時(shí)間下的單,就順延到下一個(gè)開盤日購買。
今天看到的基金凈值,其實(shí)是昨天的值。
今天購買的基金,其凈值明天才能看見。
下午3點(diǎn)以前購買基金,算作今天購買;3點(diǎn)以后,算作明天購買,即凈值要在后天才能看見。
基金管理費(fèi):一般為1%左右,每天根據(jù)資產(chǎn)總額提取,凈值是已經(jīng)提取了管理費(fèi)和托管費(fèi)后的價(jià)格。
---------------------------
基民首先要弄清楚“認(rèn)購”與“申購”的區(qū)別。
1. 認(rèn)購是針對新基金而言的,這個(gè)時(shí)候所認(rèn)購的基金并不產(chǎn)生份額凈值,成交價(jià)以1元面值為基準(zhǔn)。
2. 申購則指在基金成立后,投資者申請購買基金份額的行為。
無論是認(rèn)購還是申購,交易時(shí)間內(nèi)投資者可以提交認(rèn)/申購申請。
投資者只有在交易日下午3點(diǎn)收盤之前提交申購請求才能在當(dāng)日生效,并可能成功交易。
一般來說,投資者在份額發(fā)售期內(nèi)已經(jīng)正式受理的認(rèn)購申請不得撤銷。
對于申購申請,投資者只有在當(dāng)日 15:00前提交撤銷申請,才能予以撤銷。
在基金申購的過程中,投資者面臨著一個(gè)“未知成交價(jià)”的交易風(fēng)險(xiǎn),這是因?yàn)樯曩弮r(jià)格以當(dāng)日的基金份額凈值為基準(zhǔn)進(jìn)行計(jì)算,而成交當(dāng)日的基金份額凈值只能在下午3點(diǎn)收盤之后誕生,這個(gè)凈值一般會在下一個(gè)交易日開始之前公告。
------------------------------
收購費(fèi)率是有折扣的(根據(jù)不同的銀行),如易方達(dá)前端申購費(fèi)率是0.8%,但是如果用廣發(fā)卡費(fèi)率是0.3%,1w元能省50元呢。
"優(yōu)惠費(fèi)率不按金額分檔,持有廣東發(fā)展銀行理財(cái)通卡的個(gè)人投資者的優(yōu)惠認(rèn)購費(fèi)率或申購費(fèi)率統(tǒng)一為0.3%。"-- From 易方達(dá)
posted @
2009-02-22 17:18 Jcat 閱讀(440) |
評論 (2) |
編輯 收藏
Habit 1:
Be ProactiveChange 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 MindDevelop a principle-centered personal mission statement. Extend the mission statement into long-term goals based on personal principles.
Habit 3:
Put First Things FirstSpend 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/WinSeek 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 UnderstoodFirst 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:
SynergizeThrough 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 SawTake 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) |
編輯 收藏
很多時(shí)候,在我們進(jìn)行數(shù)據(jù)庫操作時(shí),比如drop user,drop table等,經(jīng)常會遇到這樣的錯(cuò)誤:
ORA-00604: error occurred at recursive SQL level 1 .
關(guān)于Recursive SQL錯(cuò)誤:
我們知道,當(dāng)我們發(fā)出一條簡單的命令以后,Oracle數(shù)據(jù)庫要在后臺解析這條命令,并轉(zhuǎn)換為Oracle數(shù)據(jù)庫的一系列后臺操作,這些后臺操作統(tǒng)稱為遞歸SQL。
比如create table這樣一條簡單的DDL命令,Oracle數(shù)據(jù)庫在后臺,實(shí)際上要把這個(gè)命令轉(zhuǎn)換為對于obj$,tab$,col$等底層表的插入操作。Oracle所作的工作可能比我們有時(shí)候想的要復(fù)雜的多.。
所以對于這樣的提示,很多時(shí)候是沒有絲毫用處的。
這時(shí),我們需要更詳細(xì)的信息,sql_trace就是一個(gè)好辦法。
sql_trace實(shí)際上就是Oracle內(nèi)部事件10046的第一個(gè)級別,即level=1。通過
event 10046, 我們可以得到詳細(xì)的數(shù)據(jù)庫會話的信息,每個(gè)會話究竟在干什么,在等什么。通過對這個(gè)事件的學(xué)習(xí),我們可以深入的理解和調(diào)整Oracle。
結(jié)合eygle的文章整理的,SQL Trace更詳細(xì)的用法請見原文。----------
Event 10046是oracle用于系統(tǒng)性能分析時(shí)的一個(gè)最重要的事件。當(dāng)激活這個(gè)事件后,將通知oracle kernel追蹤會話的相關(guān)即時(shí)信息,并寫入到相應(yīng)trace文件中。這些有用的信息主要包括sql是如何進(jìn)行解析,綁定變量的使用情況,話中發(fā)生的等待事件等。
Trace文件將會存放在
user_dump_dest 所指向的目錄,如,C:\ent\oracle\admin\o10g01\udump
Event 10046可分成不同的級別(level),分別追蹤記錄不同程度的有用信息。對于這些不同的級別,應(yīng)當(dāng)注意的是向下兼容的,即高一級的trace信息包含低于此級的所有信息。
??? level 1:跟蹤sql語句,包括解析、執(zhí)行、提取、提交和回滾等。
??? level 4:包括變量的詳細(xì)信息
??? level 8:包括等待事件
??? level 12:包括綁定變量與等待事件
其中,level 1相當(dāng)于打開了sql_trace。
在當(dāng)前會話啟用event,可以利用alter session + 事件名稱 + level:
SQL> alter session set event ‘10046 trace name context forever, level 12’;關(guān)閉當(dāng)前會話的event:
SQL> alter session set event ‘10046 trace name context off’;這里應(yīng)當(dāng)值得一提的是,TRACE將消耗相當(dāng)?shù)南到y(tǒng)資源,因此我們在使用TRACE的時(shí)候應(yīng)當(dāng)慎重。對于正式的系統(tǒng),應(yīng)當(dāng)只在必要的時(shí)候進(jìn)行TRACE操作,并且應(yīng)當(dāng)及時(shí)關(guān)閉。
posted @
2008-12-19 15:19 Jcat 閱讀(256) |
評論 (0) |
編輯 收藏
湖人vs雄鹿,第四節(jié)垃圾時(shí)間,孫悅終于替補(bǔ)出場。

上來就3個(gè)犯規(guī),1個(gè)運(yùn)球失誤,顯得很緊張,身體僵硬。又失誤了,隊(duì)友安慰他。
然后1個(gè)三分的機(jī)會,沒進(jìn),動作很僵硬。
終于有個(gè)中距離的機(jī)會,孫悅投中了,全場鼓掌!
后來又有一個(gè)反擊的機(jī)會,孫悅籃下打板進(jìn)了,繼續(xù)鼓掌!恭賀菜鳥的第一次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.
終于還是沒堅(jiān)持下來,看來堅(jiān)持不懈做一件很小的事也是很難的。
posted @
2008-12-03 12:07 Jcat 閱讀(290) |
評論 (0) |
編輯 收藏
Oracle Database的大版本號由兩部分組成:
數(shù)字+字母,數(shù)字自然是大版本號,
字母則是代表了這個(gè)版本的“中心思想”
8i(1998),9i(2001):那時(shí)候正好互聯(lián)網(wǎng)興起,i就代表internet(網(wǎng)絡(luò))10g(2003),11g(2007):現(xiàn)在主推分布式計(jì)算,g就代表grid(網(wǎng)格)另外,還有個(gè)11i,這容易引起混淆,其實(shí)11i是指Oracle EBS(E-Business Suite電子商務(wù)套件)的版本號,其實(shí)就是Oracle ERP。(這好像跟Oracle Database沒什么必然聯(lián)系,我也不知道這個(gè)i代表什么)
這也說明Oracle不等于Oracle Database。平常我們說“Oracle”,一般都是指Oracle Database,當(dāng)然這是它最著名的產(chǎn)品;不過,其實(shí)Oracle早就已經(jīng)不是一家數(shù)據(jù)庫廠商了,而是航母級廠商,東收西購,啥都有了。
我見過這樣的問題:“從版本命名來看8i-9i-10g-11i,是不是意味著grid只是曇花一現(xiàn)?”顯然這就是混淆了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) |
編輯 收藏
Groovy
把最常用的東西都設(shè)置成default了,經(jīng)常可以省這省那的(比如括號、分號、public等);又加上閉包,初學(xué)的時(shí)候,有些代碼,一眼望去,都分不清是方法、是類、還是閉包。
這里先簡單總結(jié)一下常用的修飾符。
package?jcat.bit.g
/*
修飾符有三類:
1.?static
2.?作用域:public(默認(rèn)),?private,?protected.
3.?類型:def(默認(rèn),動態(tài)),?void(無類型,靜態(tài)),?其它常規(guī)靜態(tài)類型
*/
class?Test?{
????static?def?a_static_def?=?'a_static_def'
????static?a_static?=?'a_static'
????def?a_def?=?'a_def'
????static?void?main(strs)?{
????????println?a_static_def
????????println?a_static
????????println?t_static_def()
????????println?t_static()
????????new?Test().with?{
????????????println?a_def
????????????println?t_public_def()
????????????println?t_public()
????????????println?t_def()
????????}
????}
????static?def?t_static_def()?{?//?def?=?可以返回任何類型,包括void
????????return?"t_static_def"
????}
????static?t_static()?{?//?有其它修飾符可以省略def(默認(rèn)public?+?def)
????????return?"t_static"
????}
????public?def?t_public_def()?{
????????return?"t_public_def"
????}
????public?t_public()?{?//?默認(rèn)def
????????return?"t_public"
????}
????def?t_def()?{?//?至少要有一個(gè)修飾符,所以這個(gè)def不能省略;?且默認(rèn)public
????????return?"t_def"
????}
????static?void?t_static_void()?{
????????//return?"t_static_void"????//?cannot?return?an?object?from?a?method?that?returns?"void"
????}
}
posted @
2008-11-10 12:30 Jcat 閱讀(1446) |
評論 (0) |
編輯 收藏
用JDBC操作數(shù)據(jù)庫,對比一下Java和Groovy。
環(huán)境:SQL Server 2000 (記得打補(bǔ)丁SP4,不然JDBC訪問會報(bào)錯(cuò))
JDBC Driver:msbase.jar,mssqlserver.jar,msutil.jar
Java版
package
?jcat.bit.java;
import
?java.sql.
*
;
public
?
class
?JDBC?{
????
public
?
static
?
void
?main(String[]?args)?
throws
?ClassNotFoundException,?SQLException?{
????????Class.forName(
"
com.microsoft.jdbc.sqlserver.SQLServerDriver
"
);
????????Connection?conn?
=
?DriverManager.getConnection(
????????????????
"
jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs
"
,
????????????????
"
sa
"
,?
"***
"
);
????????Statement?stmt?
=
?conn.createStatement();
????????ResultSet?rs?
=
?stmt.executeQuery(
"
select?top?10?*?from?authors
"
);
????????
while
?(rs.next())?{
????????????System.out.println(rs.getString(
2
)
+
"
?
"
+
rs.getString(
3
));??//?數(shù)id
????????}
????????rs.close();
????????stmt.close();
????????conn.close();
????}
}
Groovy版
package?jcat.bit.groovy
import?groovy.sql.Sql
class?JDBC?{
????static?void?main(args)?{
????????Sql?sql?=?Sql.newInstance(
????????????????"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs",
????????????????"sa",?"***",
????????????????"com.microsoft.jdbc.sqlserver.SQLServerDriver")
????????sql.eachRow("select?top?10?*?from?authors")?{row?->
????????????println?row.au_fname?+?"?"?+?row.au_lname????//直接用數(shù)據(jù)庫的字段名就可以操作結(jié)果集了,不用去數(shù)id
????????}
????}
}
總結(jié)
1. 建立查詢,差別不大,都是JDBC那一套;Groovy不用處理異常
2. 處理查詢結(jié)果,Groovy因?yàn)橛虚]包,
處理這些迭代問題很方便3. Groovy不用關(guān)閉
posted @
2008-11-07 15:02 Jcat 閱讀(1670) |
評論 (3) |
編輯 收藏
1. 閉包代表(定義)了一段代碼(操作):光看這一句,其實(shí)方法也能實(shí)現(xiàn)相同的功能呀。
2. 閉包可以作為方法的參數(shù):這才是閉包的特殊之處和真正意義。
下面演示一個(gè)只有閉包能做,方法做不到的例子。
方法的作用是提煉共性,再代之以不同的參數(shù)。即對不同的“數(shù)據(jù)”進(jìn)行相同的“操作”。從3個(gè)loop可以看出:
????Comm1:相同的數(shù)據(jù)
????Comm2:相同的for循環(huán)
????Diff1:循環(huán)體內(nèi)執(zhí)行的操作不同
Comm1很好搞定,參數(shù)aa就是提煉出的共性
Comm2看似是共性,卻很難提煉,因?yàn)閒or循環(huán)和循環(huán)體內(nèi)的操作實(shí)際是一個(gè)整體;Comm2被Diff1糾纏,3個(gè)loop是完全不同的3組操作,無法提煉。
比如,如果現(xiàn)在想要按照奇數(shù)循環(huán),只能依次改動三個(gè)循環(huán)。?
int
[]?aa?
=
?[
1
,?
2
,?
3
,?
4
,?
5
,?
6
]
//
?loop1
for
?(
int
?i?
=
?
0
;?i?
<
?aa.length;?i
++
)?{ ????println?aa[i] }
//
?loop2
for
?(
int
?i?
=
?
0
;?i?
<
?aa.length;?i
++
)?{ ????print?aa[i] }
//
?loop3
for
?(
int
?i?
=
?
0
;?i?
<
?aa.length;?i
++
)?{ ????print?aa[i]?
+
?
'
?
'
}
|
????????
//
?loop1
for
?(
int
?i?
=
?
0
;?i?
<
?aa.length;?i?
+=
?
2
)?{ ????println?aa[i] }
//
?loop2
for
?(
int
?i?
=
?
0
;?i?
<
?aa.length;?i?
+=
?
2
)?{ ????print?aa[i] }
//
?loop3
for
?(
int
?i?
=
?
0
;?i?
<
?aa.length;?i?
+=
?
2
)?{ ????print?aa[i]?
+
?
'
?
'
}
|
下面我們看看閉包的強(qiáng)大之處,Comm1和Comm2都被很好的封裝在了loop方法里;
Diff1則作為參數(shù)(閉包)傳入loop方法。
static?void?main(String[]?a)?{
????int[]?aa?=?[1,?2,?3,?4,?5,?6]
????loop(aa)?{?println?it }
??? loop(aa)?{?print?it?}???
??? loop(aa)?{?print?it?+?'?'?}
}
|
如果我們想要改變循環(huán)的方式,只需要改一處
static?void?loop(int[]?aa,?Closure?c)?{ ????for?(int?i?=?0;?i?<?aa.length;?i++)?{ ????????c.call(aa[i]) ????} ????println?'?' } | static?void?loop(int[]?aa,?Closure?c)?{ ????for?(int?i?=?0;?i?<?aa.length;?i?+=?2)?{ ????????c.call(aa[i]) ????} ????println?'?' } |
總結(jié),閉包本身并沒什么難點(diǎn),關(guān)鍵是怎樣合理的設(shè)計(jì)一個(gè)接受Closure類型參數(shù)的方法。從GDK的方法也可以看出,大多數(shù)接受閉包的方法都是和數(shù)組迭代有關(guān)(也即循環(huán))。
posted @
2008-11-07 02:04 Jcat 閱讀(1546) |
評論 (2) |
編輯 收藏