Oracle常用語句

2021-08-26 01:27:27 字數 1604 閱讀 3818

1.檢視和修改oracle伺服器端字符集:

1)檢視伺服器端字符集:

方法一:

select * from v$nls_parameters;

select * from nls_database_parameters;

select * from sys.props$;

2) 修改伺服器端字符集(用sys使用者):

首先執行:update props$ set value$ = 'we8iso8859p1' where name ='nls_characterset';

update props$ set value$ = 'china' where name ='nls_language';

提交(commit),然後,重新啟動資料庫;

3)用客戶端工具(pl/sql develop or pb etc.)查詢資料庫,若顯示亂碼,先查詢出資料庫端的字符集,然後,從登錄檔中修改nls_lang欄位的值,可能為american_america.we8iso8859p1或者simplified chinese_china.zhs16gbk或者na等。

方法二:

alter system enable restricted session;

alter database orcl character set zhs16gbk;

alter database orcl national character set zhs16gbk;

2.建立oracle表空間:

-- oracle 安裝在windows 系統 建立表空間語句

create tablespace test_service

datafile 'e:\oracle\oradata\ora92\test_service01.dbf' size 100m reuse

logging

online

permanent

extent management local uniform size 1m

--oracle 安裝在aix系統 建立表空間語句

create tablespace test_service

datafile '/dev/rdata01' size 100m reuse

logging

online

permanent

extent management local uniform size 1m

3.刪除使用者及使用者的所有物件:

drop user user cascade;

4.建立使用者,及賦予許可權:

-- create the user 

create user tcw

identified by "123456"

default tablespace users

temporary tablespace temp;

-- grant/revoke role privileges 

grant connect to tcw;

grant dba to tcw;

-- grant/revoke system privileges 

grant select any table to tcw;

oracle 常用語句

oracle 產看表空間 select total.name tablespace name free space,total space free space used space,total space from select tablespace name,sum bytes 1024 102...

oracle常用語句

drop tablespace crm online space including contents and datafiles 刪除表空間 drop user wuliu01 cascade 刪除使用者 exp orcl file d dmp 匯出資料庫 imp orcl file e alen...

oracle 常用語句

oracle 常用語句 查詢表的大小 select t.owner,t.segment name,sum t.blocks 8 1024 m as s,t.segment type from dba segments t where t.owner user name group by t.owne...