標籤:
--建立資料表空間(一個資料表空間可以有多個使用者)--
create tablespace demo
datafile ‘D:\oracle\oradata\junchen\PLATFORM\demo.dbf‘
size 50m
autoextend on;
--建立使用者,並且關聯資料表空間--
create user demo
identified by dd
default tablespace demo;
--給使用者指派許可權--
grant connect,resource to 使用者名稱;
grant create view to 使用者名稱;--建立視圖許可權
grant create sequence to 使用者名稱;--建立序列許可權
grant sysdba to 使用者名稱;--管理員權限
grant create session,create any table,create any view,create any index,create
any procedure,alter any table,alter any procedure,drop any table,drop any view,drop any index,drop any procedure,
select any table,insert any table,update any table,delete any table,dba to demo;--所有許可權
--修改資料檔案--
--查看資料檔案路徑--
select file_id,bytes,file_name from dba_data_files;
--重新指定尺寸為20M--
alter database datafile ‘資料檔案路徑‘ resize 20m;
--修改表所屬資料表空間:
alter table 表名 move tablespace "資料表空間名稱"
--修改表索引所屬資料表空間:
alter index 索引名 rebuild tablespace "資料表空間名稱"
匯出資料庫
exp userid=jsmall/[email protected]/orcl file=e:/demo.dmp
exp userid=DD_APP/[email protected]/prosc file=e:/DD_APP.dmp
exp userid=DD_EFLOW/[email protected]/prosc file=e:/DD_EFLOW.dmp
exp userid=AUTH/[email protected]/prosc file=e:/AUTH.dmp
exp userid=SB_PORTAL/[email protected]/prosc file=e:/SB_PORTAL.dmp
匯入資料庫
imp system/[email protected] file=f:\data.DMP full=y
解決oracle“這些對象由xxx匯出,而不是目前使用者”方案
imp userid=demo/[email protected]/prosc file=E:/demo.dmp ignore=y fromuser=demo touser=demo
imp userid=DD_APP/[email protected]/prosc file=E:/DD_APP.dmp ignore=y fromuser=DD_APP touser=DD_APP
imp userid=DD_EFLOW/[email protected]/prosc file=E:/DD_EFLOW.dmp ignore=y fromuser=DD_EFLOW touser=DD_EFLOW
imp userid=AUTH/[email protected]/prosc file=E:/AUTH.dmp ignore=y fromuser=AUTH touser=AUTH
imp userid=SB_PORTAL/[email protected]/prosc file=E:/SB_PORTAL.dmp ignore=y fromuser=SB_PORTAL touser=SB_PORTAL
--刪除--
--1、刪除表及序列等--
--2、刪除使用者--
drop user 使用者名稱;
--3、刪除資料表空間--
drop tablespace 使用者名稱_tablespace;
分頁:
select * from (
select row_.*, rownum rownum_ from (
查詢sql
) row_
) where rownum_ <= 結束行 and rownum_ > 起始行;
查詢總行數:
select count(1) from (查詢SQL) tmp_count;
Oracle資料庫基本操作