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;