純好人不用打:白羊
沒人防:雙子(迷宮)、天平(卡妙的冰箱)、射手(迷宮)
打死:巨蟹(紫龍)、山羊(紫龍自曝)、雙魚(阿瞬)、水瓶(冰河)
沒打過,放水:獅子(星矢)、天蝎(冰河)、金牛(星矢)、處女(一輝)
這樣看來紫龍是最NB的,一個人干掉2個,而且靠他師傅走后門天平不用打,還用天平的武器救了冰河。
冰河和他師傅干了2仗
冰河那段也挺NB,先是在天平被凍個半死,然后在天蝎被針扎個半死,最后到了水瓶還能把他師傅干掉
冰河和他師傅是最體現實力的一仗,純實力對扣
合著星矢誰也沒殺,就TM來打醬油的。。。
posted @
2011-10-21 14:29 Jcat 閱讀(561) |
評論 (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 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
創建數據庫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 閱讀(242) |
評論 (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.emptablespace 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)
--刪除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觸發器-----
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 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默認安裝時,會安裝一個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);
--創建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函數同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????????? 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--停止任務begin
dbms_scheduler.disable('test_job');
end;
--刪除任務begin
dbms_scheduler.drop_job('test_job');
end;
posted @
2009-12-17 16:13 Jcat 閱讀(247) |
評論 (0) |
編輯 收藏