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;