oracle基本操作

2021-08-31 21:19:43 字數 2127 閱讀 9976

建立使用者和表空間

--建立表空間

--表空間名

create tablespace testspace

--資料存放位置   

--原始大小和自增大小 

size 100m autoextend on next 10m maxsize 

--增長沒有上限 

unlimited logging extent management local autoallocate 

segment space management auto; 

--建立使用者並分配表空間

create user test identified by 123456 default tablespace testspace;

--給使用者授權 dba有所有許可權

grant dba to test;
--修改表空間

alter user test  default tablespace testspace2;
--修改密碼

alter user test identified by 123456;
exp匯出表

--匯出本地庫dmp檔案

exp  test/test@orcl file=d:\workdocument\test20181101.dmp    owner=test
--遠端匯出表

exp test/[email protected]/orcl file=e:\test20181101.dmp
--匯出使用者下的某個表

exp test/[email protected]/orcl file=e:\test20181101.dmp statistics=none tables=(sys_operationlog)
--匯出某個使用者下的表

exp test/[email protected]/orcl file=e:\test20181101.dmp owner=test
匯入表

ignore=y相當於,如果沒有的表,建立並倒入資料,如果已經有的表,忽略建立的,但不忽略倒入。

full=y,是匯入檔案中全部內容

imp test/test@orcl file=d:\workdocument\test20181101.dmp  full=y ignore=y
--遠端匯入表

imp  test/[email protected]/orcl file=e:\test20181101.dmp  full=y ignore=y
--匯入dmp檔案中的某個表(要將原表刪掉)

imp test/test@orcl file=f:\test.dmp  tables=(test)

刪除表空間、更改表空間

--查詢使用者

select  * from dba_users;
--查詢工作空間路徑

select * from dba_data_files;
--更改表空間

alter user 使用者名稱 default tablespace 表空間名字 ;
--刪除表空間

drop tablespace 表空間名稱 including contents and datafiles cascade constraint;
--增加列及注釋

alter table org add (zxrq varchar2(60) default   null);

--alter table usr add (zxrq varchar2(60) default sysdate not null);

comment on column org.zxrq  is '登出日期';

Oracle基本操作

1.建立表空間 create tablespacetestdatafile c test.dbf size 10m 名字不要為數字 2.建立使用者 create user username identified by password 不要為數字 3.給使用者授權 grant dba to user...

Oracle 基本操作

在這裡詳述 oracle 基本操作。新增使用者 隨著使用者的建立,自動產生與使用者同名的schema create user tester profile default identified by tester default tablespace testdata temporary table...

oracle 基本操作

1 使用者登入 sqlplus 帳號 密碼 2 檢視當前登入使用者 show user 3 檢視所有的使用者 select username from all users 4 建立臨時表空間 create temporary tablespace test temp tempfile d oracl...