国产亚洲欧美日韩精品,欧美一区二区在线免费观看,亚洲成人二区http://www.aygfsteel.com/ivanwan/category/36394.html自由的力量,自由的生活。zh-cnFri, 14 Jan 2011 04:27:56 GMTFri, 14 Jan 2011 04:27:56 GMT60oracle 10g ubuntu 64bit 不能啟動(dòng)問(wèn)題http://www.aygfsteel.com/ivanwan/archive/2011/01/13/342939.htmlivaneeoivaneeoThu, 13 Jan 2011 08:51:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2011/01/13/342939.htmlhttp://www.aygfsteel.com/ivanwan/comments/342939.htmlhttp://www.aygfsteel.com/ivanwan/archive/2011/01/13/342939.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/342939.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/342939.html

Install Oracle 64Bit On Ubuntu

Creating A Listener For the New DB

It's not a requirement to create a Listener before you create a database, but it's a good idea to do so. A Listener is a process which listens on a well-known port for requests from remote users seeking to connect to the Oracle database. Without one, therefore, you'd only ever be able to connect to the database whilst directly logged onto the server itself, which is obviously a bit of a show-stopper!

To create a Listener, we use the Network Configuration Assistant. To invoke the Assistant, just issue the command netca (should be in path) as the oracle user in a new terminal session. Press "Next" to accept the defaults. After a bit you will get to "Finish" which is where you want to finish.

netca

Creating a Database

First, find out the id of the oinstall group. You can find this from looking in System -> Admin -> Users and Groups -> Manage Groups. Alternatively, use:

cat /etc/group | grep oinstall

NB: The oinstall Group Id should be 1002 or similar. If the User/Group Applet is giving "0" then try double checking the Properties of the group. I've noticed that the Users/Groups Applet can be unreliable...

Then, as root, perform the following command. (NB: This can't be performed by sudo, you must be root)

echo "<dba_group_gid>" > /proc/sys/vm/hugetlb_shm_group

This allows the oinstall group access to hugetlbpages. Without this you will get error "ORA-27125: unable to create shared memory segment" when setting up the database.

Run the Database Configuration Assistant, or DBCA for short. You will need to be the Oracle user you set up earlier.

dbca

This is not a difficult thing to do: mostly, in our case, it involves clicking "Next" to walk through the wizard, accepting all defaults. You will be prompted when you actually need to enter something.

Just be sure to specify the correct database name (it should match what is set as your ORACLE_SID, but with a proper domain extension. By default the ORACLE_SID is orcl10, and can be found out by running the oraenv command in the oracle bin directory...

Use the password "oracle" for the password and write down the values it spits out at the end...!

NB: If you get a "ORA-12547- Lost Contact" error, make sure you have libaio1installed (sudo apt-get install libaio1)...
Well Done...!

If it all went well you now have an Oracle Db on your machine. Pat yourself on the back for getting this far and sticking with it. You still have a way to go before its all installed but go and have some tea to celebrate...! And then go on to Part 2...
Last Updated on Saturday, 16 January 2010 12:09



ivaneeo 2011-01-13 16:51 發(fā)表評(píng)論
]]>
powerdesigner 導(dǎo)入Excel文檔 做成 實(shí)體表http://www.aygfsteel.com/ivanwan/archive/2010/12/04/339776.htmlivaneeoivaneeoSat, 04 Dec 2010 02:45:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2010/12/04/339776.htmlhttp://www.aygfsteel.com/ivanwan/comments/339776.htmlhttp://www.aygfsteel.com/ivanwan/archive/2010/12/04/339776.html#Feedback1http://www.aygfsteel.com/ivanwan/comments/commentRss/339776.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/339776.html這個(gè)功能只能用powerdesigner 的腳本功能來(lái)實(shí)現(xiàn),使用起來(lái)也簡(jiǎn)單

打開(kāi)powerdesigner,shift + ctrl + X 打開(kāi)腳本窗口

輸入執(zhí)行的腳本,點(diǎn) run 即可。

簡(jiǎn)單的導(dǎo)入Excel腳本

'開(kāi)始
Option Explicit

Dim mdl ' the current model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
   MsgBox "There is no Active Model"
End If

Dim HaveExcel
Dim RQ
RQ = vbYes 'MsgBox("Is Excel Installed on your machine ?", vbYesNo + vbInformation, "Confirmation")
If RQ = vbYes Then
   HaveExcel = True
   ' Open & Create Excel Document
   Dim x1  '
   Set x1 = CreateObject("Excel.Application")
   x1.Workbooks.Open "D:\11.xls"   '指定excel文檔路徑
   x1.Workbooks(1).Worksheets("Sheet1").Activate   '指定要打開(kāi)的sheet名稱
Else
   HaveExcel = False
End If

a x1, mdl

sub a(x1, mdl)
dim rwIndex   
dim tableName
dim colname
dim table
dim col
dim count

on error Resume Next

set table = mdl.Tables.CreateNew '創(chuàng)建一個(gè)表實(shí)體
table.Name = "卡片信息表"    '指定表名,如果在Excel文檔里有,也可以 .Cells(rwIndex, 3).Value 這樣指定
table.Code = "AM_CARDINFO"  '指定表名
count = count + 1

For rwIndex = 2 To 1000   '指定要遍歷的Excel行標(biāo)  由于第1行是表頭,從第2行開(kāi)始
        With x1.Workbooks(1).Worksheets("Sheet1")
            If .Cells(rwIndex, 1).Value = "" Then
               Exit For
            End If

               set col = table.Columns.CreateNew   '創(chuàng)建一列/字段
               'MsgBox .Cells(rwIndex, 1).Value, vbOK + vbInformation, "列"
               If .Cells(rwIndex, 3).Value = "" Then
                  col.Name = .Cells(rwIndex, 1).Value   '指定列名
               Else 
                  col.Name = .Cells(rwIndex, 3).Value
               End If
               'MsgBox col.Name, vbOK + vbInformation, "列"
               col.Code = .Cells(rwIndex, 1).Value   '指定列名
               
               col.DataType = .Cells(rwIndex, 2).Value   '指定列數(shù)據(jù)類型
               
               col.Comment = .Cells(rwIndex, 5).Value  '指定列說(shuō)明
               
               If .Cells(rwIndex, 4).Value = "否" Then
                   col.Mandatory = true        '指定列是否可空  true  為不可空                  
               End If
               
               If rwIndex = 2 Then
                   col.Primary = true    '指定主鍵
               End If
        End With
Next
MsgBox "生成數(shù)據(jù)表結(jié)構(gòu)共計(jì) " + CStr(count), vbOK + vbInformation, "表"

Exit Sub
End sub




ivaneeo 2010-12-04 10:45 發(fā)表評(píng)論
]]>
Oracle10g常見(jiàn)HINT的用法http://www.aygfsteel.com/ivanwan/archive/2010/12/02/339588.htmlivaneeoivaneeoThu, 02 Dec 2010 03:40:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2010/12/02/339588.htmlhttp://www.aygfsteel.com/ivanwan/comments/339588.htmlhttp://www.aygfsteel.com/ivanwan/archive/2010/12/02/339588.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/339588.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/339588.html 如果表使用了別名, 那么提示里也必須使用別名, 如:select /*+ hint1(t1) */ col1, col2 from tab1 t1 where col1='xxx';
在SQL優(yōu)化過(guò)程中常見(jiàn)HINT的用法(前10個(gè)比較常用, 前3個(gè)最常用):
1. /*+ INDEX */ 和 /*+ INDEX(TABLE INDEX1, index2) */ 和 /*+ INDEX(tab1.col1 tab2.col2) */ 和 /*+ NO_INDEX */ 和 /*+ NO_INDEX(TABLE INDEX1, index2) */
表明對(duì)表選擇索引的掃描方法. 第一種不指定索引名是讓Oracle對(duì)表中可用索引比較并選擇某個(gè)最佳索引; 第二種是指定索引名且可指定多個(gè)索引; 第三種是10g開(kāi)始有的, 指定列名, 且表名可不用別名; 第四種即全表掃描; 第五種表示禁用某個(gè)索引, 特別適合于準(zhǔn)備刪除某個(gè)索引前的評(píng)估操作. 如果同時(shí)使用了INDEX和NO_INDEX則兩個(gè)提示都會(huì)被忽略掉.
例如:SELECT /*+ INDEX(BSEMPMS SEX_INDEX) USE SEX_INDEX BECAUSE THERE ARE FEWMALE BSEMPMS */ FROM BSEMPMS WHERE SEX='M';
2. /*+ ORDERED */
FROM子句中默認(rèn)最后一個(gè)表是驅(qū)動(dòng)表,ORDERED將from子句中第一個(gè)表作為驅(qū)動(dòng)表. 特別適合于多表連接非常慢時(shí)嘗試.
例如:SELECT /*+ ORDERED */ A.COL1,B.COL2,C.COL3 FROM TABLE1 A,TABLE2 B,TABLE3 C WHERE A.COL1=B.COL1 AND B.COL1=C.COL1;
3. /*+ PARALLEL(table1,DEGREE) */ 和 /*+ NO_PARALLEL(table1) */
該提示會(huì)將需要執(zhí)行全表掃描的查詢分成多個(gè)部分(并行度)執(zhí)行, 然后在不同的操作系統(tǒng)進(jìn)程中處理每個(gè)部分. 該提示還可用于DML語(yǔ)句. 如果SQL里還有排序操作, 進(jìn)程數(shù)會(huì)翻倍,此外還有一個(gè)一個(gè)負(fù)責(zé)組合這些部分的進(jìn)程,如下面的例子會(huì)產(chǎn)生9個(gè)進(jìn)程. 如果在提示中沒(méi)有指定DEGREE, 那么就會(huì)使用創(chuàng)建表時(shí)的默認(rèn)值. 該提示在默認(rèn)情況下會(huì)使用APPEND提示. NO_PARALLEL是禁止并行操作,否則語(yǔ)句會(huì)使用由于定義了并行對(duì)象而產(chǎn)生的并行處理.
例如:select /*+ PARALLEL(tab_test,4) */ col1, col2 from tab_test order by col2;
4. /*+ FIRST_ROWS */ 和 /*+ FIRST_ROWS(n) */
表示用最快速度獲得第1/n行, 獲得最佳響應(yīng)時(shí)間, 使資源消耗最小化.
在update和delete語(yǔ)句里會(huì)被忽略, 使用分組語(yǔ)句如group by/distinct/intersect/minus/union時(shí)也會(huì)被忽略.
例如:SELECT /*+ FIRST_ROWS */ EMP_NO,EMP_NAM,DAT_IN FROM BSEMPMS WHERE EMP_NO='SCOTT';
5. /*+ RULE */
表明對(duì)語(yǔ)句塊選擇基于規(guī)則的優(yōu)化方法.
例如:SELECT /*+ RULE */ EMP_NO,EMP_NAM,DAT_IN FROM BSEMPMS WHERE EMP_NO='SCOTT';
6. /*+ FULL(TABLE) */
表明對(duì)表選擇全局掃描的方法.
例如:SELECT /*+ FULL(A) */ EMP_NO,EMP_NAM FROM BSEMPMS A WHERE EMP_NO='SCOTT';
7. /*+ LEADING(TABLE) */
類似于ORDERED提示, 將指定的表作為連接次序中的驅(qū)動(dòng)表.
8. /*+ USE_NL(TABLE1,TABLE2) */
將指定表與嵌套的連接的行源進(jìn)行連接,以最快速度返回第一行再連接,與USE_MERGE剛好相反.
例如:SELECT /*+ ORDERED USE_NL(BSEMPMS) */ BSDPTMS.DPT_NO,BSEMPMS.EMP_NO,BSEMPMS.EMP_NAM FROM BSEMPMS,BSDPTMS WHERE BSEMPMS.DPT_NO=BSDPTMS.DPT_NO;
9. /*+ APPEND */ 和 /*+ NOAPPEND */
直接插入到表的最后,該提示不會(huì)檢查當(dāng)前是否有插入操作所需的塊空間而是直接添加到新塊中, 所以可以提高速度. 當(dāng)然也會(huì)浪費(fèi)些空間, 因?yàn)樗粫?huì)使用那些做了delete操作的塊空間. NOAPPEND提示則相反,所以會(huì)取消PARALLEL提示的默認(rèn)APPEND提示.
例如:insert /*+ append */ into test1 select * from test4;
insert /*+ parallel(test1) noappend */ into test1 select * from test4;
10. /*+ USE_HASH(TABLE1,table2) */
將指定的表與其它行源通過(guò)哈希連接方式連接起來(lái).為較大的結(jié)果集提供最佳響應(yīng)時(shí)間. 類似于在連接表的結(jié)果中遍歷每個(gè)表上每個(gè)結(jié)果的嵌套循環(huán), 指定的hash表將被放入內(nèi)存, 所以需要有足夠的內(nèi)存(hash_area_size或pga_aggregate_target)才能保證語(yǔ)句正確執(zhí)行, 否則將在磁盤(pán)里進(jìn)行.
例如:SELECT /*+ USE_HASH(BSEMPMS,BSDPTMS) */ * FROM BSEMPMS,BSDPTMS WHERE BSEMPMS.DPT_NO=BSDPTMS.DPT_NO;
----------------------------------------------------------------------------------------------------
11. /*+ USE_MERGE(TABLE) */
將指定的表與其它行源通過(guò)合并排序連接方式連接起來(lái).特別適合于那種在多個(gè)表大量行上進(jìn)行集合操作的查詢, 它會(huì)將指定表檢索到的的所有行排序后再被合并, 與USE_NL剛好相反.
例如:SELECT /*+ USE_MERGE(BSEMPMS,BSDPTMS) */ * FROM BSEMPMS,BSDPTMS WHERE BSEMPMS.DPT_NO=BSDPTMS.DPT_NO;
12. /*+ ALL_ROWS */
表明對(duì)語(yǔ)句塊選擇基于開(kāi)銷的優(yōu)化方法,并獲得最佳吞吐量,使資源消耗最小化. 可能會(huì)限制某些索引的使用.
例如:SELECT /*+ ALL+_ROWS */ EMP_NO,EMP_NAM,DAT_IN FROM BSEMPMS WHERE EMP_NO='SCOTT';
13. /*+ CLUSTER(TABLE) */
提示明確表明對(duì)指定表選擇簇掃描的訪問(wèn)方法. 如果經(jīng)常訪問(wèn)連接表但很少修改它, 那就使用集群提示.
例如:SELECT /*+ CLUSTER */ BSEMPMS.EMP_NO,DPT_NO FROM BSEMPMS,BSDPTMS WHERE DPT_NO='TEC304' AND BSEMPMS.DPT_NO=BSDPTMS.DPT_NO;
14. /*+ INDEX_ASC(TABLE INDEX1, INDEX2) */
表明對(duì)表選擇索引升序的掃描方法. 從8i開(kāi)始, 這個(gè)提示和INDEX提示功能一樣, 因?yàn)槟J(rèn)oracle就是按照升序掃描索引的, 除非未來(lái)oracle還退出降序掃描索引.
例如:SELECT /*+ INDEX_ASC(BSEMPMS PK_BSEMPMS) */ FROM BSEMPMS WHERE DPT_NO='SCOTT';
15. /*+ INDEX_COMBINE(TABLE INDEX1, INDEX2) */
指定多個(gè)位圖索引, 對(duì)于B樹(shù)索引則使用INDEX這個(gè)提示,如果INDEX_COMBINE中沒(méi)有提供作為參數(shù)的索引,將選擇出位圖索引的布爾組合方式.
例如:SELECT /*+ INDEX_COMBINE(BSEMPMS SAL_BMI HIREDATE_BMI) */ * FROM BSEMPMS WHERE SAL<5000000 AND HIREDATE<SYSDATE;
16. /*+ INDEX_JOIN(TABLE INDEX1, INDEX2) */
合并索引, 所有數(shù)據(jù)都已經(jīng)包含在這兩個(gè)索引里, 不會(huì)再去訪問(wèn)表, 比使用索引并通過(guò)rowid去掃描表要快5倍.
例如:SELECT /*+ INDEX_JOIN(BSEMPMS SAL_HMI HIREDATE_BMI) */ SAL,HIREDATE FROM BSEMPMS WHERE SAL<60000;
17. /*+ INDEX_DESC(TABLE INDEX1, INDEX2) */
表明對(duì)表選擇索引降序的掃描方法.
例如:SELECT /*+ INDEX_DESC(BSEMPMS PK_BSEMPMS) */ FROM BSEMPMS WHERE DPT_NO='SCOTT';
18. /*+ INDEX_FFS(TABLE INDEX_NAME) */
對(duì)指定的表執(zhí)行快速全索引掃描,而不是全表掃描的辦法.要求要檢索的列都在索引里, 如果表有很多列時(shí)特別適用該提示.
例如:SELECT /*+ INDEX_FFS(BSEMPMS IN_EMPNAM) */ * FROM BSEMPMS WHERE DPT_NO='TEC305';
19. /*+ NO_EXPAND */
對(duì)于WHERE后面的OR 或者IN-LIST的查詢語(yǔ)句,NO_EXPAND將阻止其基于優(yōu)化器對(duì)其進(jìn)行擴(kuò)展, 縮短解析時(shí)間.
例如:SELECT /*+ NO_EXPAND */ * FROM BSEMPMS WHERE DPT_NO='TDC506' AND SEX='M';
20. /*+ DRIVING_SITE(TABLE) */
強(qiáng)制與ORACLE所選擇的位置不同的表進(jìn)行查詢執(zhí)行.特別適用于通過(guò)dblink連接的遠(yuǎn)程表.
例如:SELECT /*+ DRIVING_SITE(DEPT) */ * FROM BSEMPMS,DEPT@BSDPTMS DEPT WHERE BSEMPMS.DPT_NO=DEPT.DPT_NO;
21. /*+ CACHE(TABLE) */ 和 /*+ NOCACHE(TABLE) */
當(dāng)進(jìn)行全表掃描時(shí),CACHE提示能夠?qū)⒈砣烤彺娴絻?nèi)存中,這樣訪問(wèn)同一個(gè)表的用戶可直接在內(nèi)存中查找數(shù)據(jù). 比較適合數(shù)據(jù)量小但常被訪問(wèn)的表, 也可以建表時(shí)指定cache選項(xiàng)這樣在第一次訪問(wèn)時(shí)就可以對(duì)其緩存. NOCACHE則表示對(duì)已經(jīng)指定了CACHE選項(xiàng)的表不進(jìn)行緩存.
例如:SELECT /*+ FULL(BSEMPMS) CAHE(BSEMPMS) */ EMP_NAM FROM BSEMPMS;
22. /*+ PUSH_SUBQ */
當(dāng)SQL里用到了子查詢且返回相對(duì)少的行時(shí), 該提示可以盡可能早對(duì)子查詢進(jìn)行評(píng)估從而改善性能, 不適用于合并連接或帶遠(yuǎn)程表的連接.
例如:select /*+ PUSH_SUBQ */ emp.empno, emp.ename, itemno from emp, orders where emp.empno = orders.empno and emp.deptno = (select deptno from dept where loc='XXX');
23. /*+ INDEX_SS(TABLE INDEX1,INDEX2) */
指示對(duì)特定表的索引使用跳躍掃描, 即當(dāng)組合索引的第一列不在where子句中時(shí), 讓其使用該索引.


ivaneeo 2010-12-02 11:40 發(fā)表評(píng)論
]]>
oracle表空間操作集錦http://www.aygfsteel.com/ivanwan/archive/2010/12/02/339578.htmlivaneeoivaneeoThu, 02 Dec 2010 02:31:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2010/12/02/339578.htmlhttp://www.aygfsteel.com/ivanwan/comments/339578.htmlhttp://www.aygfsteel.com/ivanwan/archive/2010/12/02/339578.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/339578.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/339578.html一、建立表空間

CREATE TABLESPACE test
DATAFILE 'c:/oracle/oradata/db/test01.dbf' SIZE 50M
UNIFORM SIZE 1M;              #指定區(qū)尺寸為128k,如不指定,區(qū)尺寸默認(rèn)為64k

CREATE TABLESPACE test
DATAFILE 'c:/oracle/oradata/db/test01.dbf' SIZE 50M
MINIMUM EXTENT 50K EXTENT MANAGEMENT LOCAL
DEFAULT STORAGE (INITIAL 50K NEXT 50K MAXEXTENTS 100 PCTINCREASE 0);

可從dba_tablespaces中查看剛創(chuàng)建的表空間的信息

二、建立UNDO表空間

CREATE UNDO TABLESPACE test_undo
DATAFILE 'c:/oracle/oradata/db/test_undo.dbf' SIZE 50M

UNDO表空間的EXTENT是由本地管理的,而且在創(chuàng)建時(shí)的SQL語(yǔ)句中只能使用DATAFILE和EXTENT MANAGEMENT子句。

ORACLE規(guī)定在任何時(shí)刻只能將一個(gè)還原表空間賦予數(shù)據(jù)庫(kù),即在一個(gè)實(shí)例中可以有多個(gè)還原表空間存在,但只能有一個(gè)為活動(dòng)的。可以使用ALTER SYSTEM命令進(jìn)行還原表空間的切換。

SQL> ALTER SYSTEM SET UNDO_TABLESPACE = test_undo;

三、建立臨時(shí)表空間

CREATE TEMPORARY TABLESPACE test_temp
TEMPFILE '/oracle/oradata/db/test_temp.dbf' SIZE 50M

查看系統(tǒng)當(dāng)前默認(rèn)的臨時(shí)表空間
select * from dba_properties where property_name like 'DEFAULT%'

改變系統(tǒng)默認(rèn)臨時(shí)表空間
alter database default temporary tablespace test_temp;

四、改變表空間狀態(tài)

1.使表空間脫機(jī)

ALTER TABLESPACE test OFFLINE;

如果是意外刪除了數(shù)據(jù)文件,則必須帶有RECOVER選項(xiàng)

ALTER TABLESPACE game test FOR RECOVER;

2.使表空間聯(lián)機(jī)

ALTER TABLESPACE test ONLINE;


3.使數(shù)據(jù)文件脫機(jī)

ALTER DATABASE DATAFILE 3 OFFLINE;

4.使數(shù)據(jù)文件聯(lián)機(jī)

ALTER DATABASE DATAFILE 3 ONLINE;

5.使表空間只讀

ALTER TABLESPACE test READ ONLY;

6.使表空間可讀寫(xiě)

ALTER TABLESPACE test READ WRITE;

五、刪除表空間

DROP TABLESPACE test INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS;

DROP TABLESPACE 表空間名 [INCLUDING CONTENTS [AND DATAFILES] [CASCADE CONSTRAINTS]]

1. INCLUDING CONTENTS 子句用來(lái)刪除段

2. AND DATAFILES 子句用來(lái)刪除數(shù)據(jù)文件

3. CASCADE CONSTRAINTS 子句用來(lái)刪除所有的引用完整性約束

六、擴(kuò)展表空間

首先查看表空間的名字和所屬文件

select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files
order by tablespace_name;

1.增加數(shù)據(jù)文件
   ALTER TABLESPACE test
   ADD DATAFILE '/oracle/oradata/db/test02.dbf' SIZE 1000M;

2.手動(dòng)增加數(shù)據(jù)文件尺寸
   ALTER DATABASE DATAFILE 'c:/oracle/oradata/db/test01.dbf'
   RESIZE 100M;

3.設(shè)定數(shù)據(jù)文件自動(dòng)擴(kuò)展
   ALTER DATABASE DATAFILE 'c:/oracle/oradata/db/test01.dbf'
   AUTOEXTEND ON NEXT 100M
   MAXSIZE 200M;

設(shè)定后可從dba_tablespace中查看表空間信息,從v$datafile中查看對(duì)應(yīng)的數(shù)據(jù)文件信息



ivaneeo 2010-12-02 10:31 發(fā)表評(píng)論
]]>
六分鐘學(xué)會(huì)創(chuàng)建Oracle表空間的步驟http://www.aygfsteel.com/ivanwan/archive/2010/12/02/339571.htmlivaneeoivaneeoThu, 02 Dec 2010 01:37:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2010/12/02/339571.htmlhttp://www.aygfsteel.com/ivanwan/comments/339571.htmlhttp://www.aygfsteel.com/ivanwan/archive/2010/12/02/339571.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/339571.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/339571.html經(jīng)過(guò)長(zhǎng)時(shí)間學(xué)習(xí)創(chuàng)建Oracle表空間,于是和大家分享一下,看完本文你肯定有不少收獲,希望本文能教會(huì)你更多東西。

1、先查詢空閑空間

  1. select tablespace_name,file_id,block_id,bytes,blocks from dba_free_space; 

2、增加Oracle表空間

先查詢數(shù)據(jù)文件名稱、大小和路徑的信息,語(yǔ)句如下:

  1. select tablespace_name,file_id,bytes,file_name from dba_data_files; 

3、修改文件大小語(yǔ)句如下

  1. alter database datafile   
  2. '需要增加的數(shù)據(jù)文件路徑,即上面查詢出來(lái)的路徑  
  3. 'resize 800M; 

4、創(chuàng)建Oracle表空間

  1. create tablespace test  
  2. datafile '/home/app/oracle/oradata/oracle8i/test01.dbf' size 8M  
  3. autoextend on  
  4. next 5M  
  5. maxsize 10M;  
  6.  
  7. create tablespace sales  
  8. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  9. autoextend on  
  10. next 50M  
  11. maxsize unlimited  
  12. maxsize unlimited 是大小不受限制  
  13.  
  14. create tablespace sales  
  15. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  16. autoextend on  
  17. next 50M  
  18. maxsize 1000M  
  19. extent management local uniform;  
  20. unform表示區(qū)的大小相同,默認(rèn)為1M  
  21.  
  22. create tablespace sales  
  23. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  24. autoextend on  
  25. next 50M  
  26. maxsize 1000M  
  27. extent management local uniform size 500K;  
  28. unform size 500K表示區(qū)的大小相同,為500K  
  29.  
  30. create tablespace sales  
  31. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  32. autoextend on  
  33. next 50M  
  34. maxsize 1000M  
  35. extent management local autoallocate;  
  36. autoallocate表示區(qū)的大小由隨表的大小自動(dòng)動(dòng)態(tài)改變,大表使用大區(qū)小表使用小區(qū)  
  37.  
  38. create tablespace sales  
  39. datafile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  40. autoextend on  
  41. next 50M  
  42. maxsize 1000M  
  43. temporary;  
  44. temporary創(chuàng)建字典管理臨時(shí)表空間  
  45.  
  46. create temporary tablespace sales  
  47. tempfile '/home/app/oracle/oradata/oracle8i/sales01.dbf' size 800M  
  48. autoextend on  
  49. next 50M  
  50. maxsize 1000M  
  51. 創(chuàng)建本地管理臨時(shí)表空間,如果是臨時(shí)表空間,所有語(yǔ)句中的datafile都換為tempfile  
  52.  
  53. 8i系統(tǒng)默認(rèn)創(chuàng)建字典管理臨時(shí)表空間,要?jiǎng)?chuàng)建本地管理臨時(shí)表空間要加temporary tablespace關(guān)鍵字  
  54. 創(chuàng)建本地管理臨時(shí)表空間時(shí),不得使用atuoallocate參數(shù),系統(tǒng)默認(rèn)創(chuàng)建uniform管理方式  
  55.  
  56. 為表空間增加數(shù)據(jù)文件:  
  57. alter tablespace sales add  
  58. datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M  
  59. autoextend on next 50M  
  60. maxsize 1000M; 

創(chuàng)建本地管理臨時(shí)Oracle表空間,如果是臨時(shí)表空間,所有語(yǔ)句中的datafile都換為tempfile8i系統(tǒng)默認(rèn)創(chuàng)建字典管理臨時(shí)表空 間,要?jiǎng)?chuàng)建本地管理臨時(shí)表空間要加temporary tablespace關(guān)鍵字創(chuàng)建本地管理臨時(shí)表空間時(shí),不得使用atuoallocate參數(shù),系統(tǒng)默認(rèn)創(chuàng)建uniform管理方式

為表空間增加數(shù)據(jù)文件:

  1. alter tablespace sales add  
  2. datafile '/home/app/oracle/oradata/oracle8i/sales02.dbf' size 800M  
  3. autoextend on next 50M  
  4. maxsize 1000M; 

5、更改自動(dòng)擴(kuò)展屬性:

  1. alter database datafile  
  2. '/home/app/oracle/oradata/oracle8i/sales01.dbf',  
  3. '/home/app/oracle/oradata/oracle8i/sales02.dbf'  
  4. '/home/app/oracle/oradata/oracle8i/sales01.dbf  
  5. autoextend off; 

以上介紹創(chuàng)建Oracle表空間,在這里拿出來(lái)和大家分享一下,希望對(duì)大家有用。



ivaneeo 2010-12-02 09:37 發(fā)表評(píng)論
]]>
Redo Log和Archive Loghttp://www.aygfsteel.com/ivanwan/archive/2010/10/19/335574.htmlivaneeoivaneeoTue, 19 Oct 2010 07:00:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2010/10/19/335574.htmlhttp://www.aygfsteel.com/ivanwan/comments/335574.htmlhttp://www.aygfsteel.com/ivanwan/archive/2010/10/19/335574.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/335574.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/335574.html熟悉Oracle9i的人應(yīng)該都知道,Oracle9i中有2種日志,一種稱為Redo Log(重做日志),另一種叫做Archive Log(歸檔日志),但是這兩種日志在Oracle9i數(shù)據(jù)庫(kù)中所起到的作用相信很難有人說(shuō)清楚,下面我就結(jié)合自己對(duì)Oracle9i的認(rèn)識(shí)來(lái)進(jìn)行一下說(shuō)明

重做日志redo log file是LGWR進(jìn)程從Oracle實(shí)例中的redo log buffer寫(xiě)入的,是循環(huán)利用的。就是說(shuō)一個(gè)redo log file(group) 寫(xiě)滿后,才寫(xiě)下一個(gè)。
歸檔日志archive log是當(dāng)數(shù)據(jù)庫(kù)運(yùn)行在歸檔模式下時(shí),一個(gè)redo log file(group)寫(xiě)滿后,由ARCn進(jìn)程將重做日志的內(nèi)容備份到歸檔日志文件下,然后這個(gè)redo log file(group)才能被下一次使用。

不管數(shù)據(jù)庫(kù)是否是歸檔模式,重做日志是肯定要寫(xiě)的。而只有數(shù)據(jù)庫(kù)在歸檔模式下,重做日志才會(huì)備份,形成歸檔日志。

歸檔日志結(jié)合全備份,用于數(shù)據(jù)庫(kù)出現(xiàn)問(wèn)題后的恢復(fù)使用。



ivaneeo 2010-10-19 15:00 發(fā)表評(píng)論
]]>
guid類型的使用http://www.aygfsteel.com/ivanwan/archive/2008/12/01/243711.htmlivaneeoivaneeoMon, 01 Dec 2008 07:08:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2008/12/01/243711.htmlhttp://www.aygfsteel.com/ivanwan/comments/243711.htmlhttp://www.aygfsteel.com/ivanwan/archive/2008/12/01/243711.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/243711.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/243711.html生成: SELECT SYS_GUID ()
INTO v_guid
FROM DUAL;

ivaneeo 2008-12-01 15:08 發(fā)表評(píng)論
]]>
for in 使用的例子http://www.aygfsteel.com/ivanwan/archive/2008/12/01/243710.htmlivaneeoivaneeoMon, 01 Dec 2008 07:07:00 GMThttp://www.aygfsteel.com/ivanwan/archive/2008/12/01/243710.htmlhttp://www.aygfsteel.com/ivanwan/comments/243710.htmlhttp://www.aygfsteel.com/ivanwan/archive/2008/12/01/243710.html#Feedback0http://www.aygfsteel.com/ivanwan/comments/commentRss/243710.htmlhttp://www.aygfsteel.com/ivanwan/services/trackbacks/243710.html

ivaneeo 2008-12-01 15:07 發(fā)表評(píng)論
]]>
主站蜘蛛池模板: 茌平县| 谢通门县| 蕲春县| 西吉县| 长武县| 沈丘县| 务川| 抚松县| 蕲春县| 汶川县| 耿马| 和龙市| 西华县| 彝良县| 天水市| 天镇县| 通河县| 阿巴嘎旗| 昌黎县| 伊金霍洛旗| 徐州市| 长子县| 哈密市| 平南县| 泗水县| 乌拉特后旗| 乌拉特前旗| 凤城市| 尼木县| 宜阳县| 泽普县| 文昌市| 凌海市| 揭阳市| 太白县| 马边| 福清市| 封丘县| 红河县| 镇巴县| 景东|