oracle筆記一

來源:互聯網
上載者:User

標籤:

一.Oracle簡介

1.Oracle屬於關係型資料庫,是一款可以在Client/Server模式下啟動並執行RDBMS產品。2009年,Oracle公司收購SUN。

2.Oracle是對象關係型資料庫管理系統(ORDBMS)。

3.Oracle資料庫的主要特點。

支援多使用者,大事務量的交易處理。

支援分散式交易處理。

可移植性好。

4.由一個Oracle資料庫和多個執行個體組成。

Oracle資料庫:位於硬碟上實際存放資料的檔案,這些檔案組合在一起成為一個邏輯整體。

Oracle執行個體:位於實體記憶體裡的資料結構,由一個共用的記憶體池和多個後台進程所組成。使用者如果需要存取資料庫裡的資料,必須要通過執行個體才能實現。

區別:執行個體可以操作資料庫,任何時候一個執行個體只能與一個資料庫關聯。大多數情況下,一個資料庫上只有一個執行個體對其進行操作。

 

5.

sys最大,下來是system,scott許可權最小。

二.sqlplus命令。

 cmd>sqlplus scott/[email protected]:1521/orcl

 192.168.1.131:1521為伺服器主機ip地址。orcl為資料庫名。

 select * from tab;         查看使用者下的表。

 desc student;              查看錶結構。

insert into student values(1,‘張三‘,‘男‘);       commit   提交  插入記錄。

select * from student;        查看錶中的資料。

ed      打出sql語句,便於修改語句。  改完後 /+斷行符號執行。

修改一個單詞:

create tablespace ma 

datafile ‘E:\aaa.DBF‘

size 50M

autoextend on next 50M maxsize 2048M;                    建立資料表空間文法。

 

alter tablespace ma

datafile ‘E:\aaa.DBF‘

size 5M

autoextend on next 5M maxsize 10M;                           修改資料表空間。

 

drop tablespace ma including contents and datafiles;        刪除資料表空間。

 

create temporary tablespace ma_temp                            建立暫存資料表空間。

tempfile ‘E:\aaa.DBF‘

size 5M

autoextend on next 5M maxsize 10M;

 

create user yxn identified by yxn                                   建立使用者

default tablespace ma

temporary tablespace ma_temp;

 

grant connect,resource,dba to yxn;                                授權使用者

 

show linesize          顯示表寬度。

set linesize 150       設定表寬度。

spool e:aaa.txt       將spool之間的內容寫到aaa.txt

spool off;

list                         查看緩衝區。

exit;                      退出使用者。

col mname for a20;                修改列的寬度。                      

 

 三.Oracle資料類型

varchar和varchar2的區別?

存null的時候,vachar會自動轉換為" ",而varchar2還是存null。

 

oracle筆記一

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.