Oracle--基礎

來源:互聯網
上載者:User

標籤:基礎   nvl   rom   select   maxsize   files   --   oracl   dmi   

 

Oracle資料庫的體繫結構

  資料庫database

    Oracle資料庫是資料的實體儲存體。

    包括資料檔案ORA或者DBF、控制檔案、聯機日誌、參數檔案

    這裡的資料庫是一個作業系統只有一個庫

    可以把Oracle看做是一個大資料庫

  執行個體

    一個Oracleshilling(Oracle Instance)有一系列後台進程(BackGround Processes)he和

    一個資料庫可以有n個執行個體

  資料檔案(dbf)

    資料檔案是資料庫的實體儲存體單位。

    資料庫的資料是儲存在資料表空間中的

    在一個或多個資料檔案中

    而一個資料表空間可以有一個或 多個資料檔案組成

    

  使用者:

    使用者是在執行個體下建立的

    可以在不同的執行個體中建立相同名字的使用者

    說明:

      Oracle的資料管理是由使用者和資料表空間來管理的

      不同的使用者可以在同一個資料表空間中建立相同名字的表

 

執行個體 資料表空間 資料檔案 資料

 1 --以下操作均是使用SYSTEM使用者登入 2  3 --查看資料庫版本Version 4 select version 5 from product_component_version; 6 where substr(product,1,6) = ‘Oracle‘; 7  8 --查看當前使用的資料庫執行個體 9 select instance_name from v$instance;10 11 --查看當前執行個體中所有使用者12 select * from dba_users;13 14 --查看所有資料表空間容量的大小和它的使用方式15 select a.tablespace_name "資料表空間名",16        total "資料表空間大小",17        total/(1024*1024*1024) "資料表空間大小(G)",18        free/(1024*1024*1024) "資料表空間剩餘大小(G)",19        free "資料表空間剩餘大小",20        (total - free) "資料表空間使用大小",21        round((total - free)/total,4)*100 "使用率 %"22 from 23        (select tablespace_name,SUM(bytes) free from dba_free_space24                group by tablespace_name) a,25        (select tablespace_name,SUM(bytes) total from dba_data_files26                group by tablespace_name) b27 where a.tablespace_name = b.tablespace_name and28 a.tablespace_name=‘JK_TBS‘;29 30 --查看資料檔案相關資訊31 select b.tablespace_name 資料表空間, 32        b.file_name 物理檔案名稱,33        b.bytes / 1024 / 1024 大小M,34        (b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 已使用M,35        substr((b.bytes - sum(nvl(a.bytes, 0))) / (b.bytes) * 100, 1, 5) 利用率   36 from dba_free_space a,37      dba_data_files b   38 where a.file_id = b.file_id   39 group by b.tablespace_name,40          b.file_name,41          b.bytes   42 order by b.tablespace_name;43 44 --使用SYSTEM使用者登入45 46 --建立一個資料表空間(至少添加一個資料檔案)47 create tablespace wdmlsx48 datafile ‘C:\tablespace\wdmlsx\datafile\mainFile.dbf‘49 size 100M;50 51 --給已存在的資料表空間添加一個資料檔案52 alter tablespace wdmlsx add 53 datafile ‘C:\tablespace\wdmlsx\datafile\secondFile.dbf‘54 size 50M;55 56 --添加一個允許自動成長的資料檔案57 alter tablespace wdmlsx add 58 datafile ‘C:\tablespace\wdmlsx\datafile\thirdFile.dbf‘59 size 20M60 autoextend on next 5M maxsize 100M;61 62 --允許已存在的資料檔案自動成長63 alter database 64 datafile ‘C:\tablespace\wdmlsx\datafile\mainFile.dbf‘65 autoextend on next 5M maxsize 200M;66 67 --手工改變已存在資料檔案的大小68 alter database69 datafile ‘C:\tablespace\wdmlsx\datafile\secondFile.dbf‘70 resize 20M;71 72 --使用SYSTEM使用者登入73 74 75 --建立使用者並給使用者指派資料表空間76 create user lsx identified by lsx 77 default tablespace wdmlsx78 account unlock;79 create user wdm identified by wdm 80 default tablespace wdmlsx81 account unlock;82 83 --給使用者LSX分配許可權 connect和resource84 grant connect,resource to lsx;85 --給使用者WDM分配許可權 dba86 grant dba to wdm;87 88 --刪除使用者連同其建立的東西全部刪除89 drop user itcast cascade;90 91 --允許使用者傳遞自己的許可權給其他使用者92 grant connect,resource to lsx with admin option;

 

 

    

 

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.