标签 oracle 下的文章

查看数据库的字符集

select * from v$nls_parameters;
select * from nls_database_parameters;
[root@server183/] sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 7 23:50:56 2012 

Copyright (c) 1982, 2010, Oracle.  All rights reserved. 

SQL> conn / as sysdba     --需要使用SYSDBA帐户 
Connected. 
SQL>  startup mount        
ORA-01081: cannot start already-running ORACLE - shut it down first 
SQL>  shutdown immediate;   --停止数据库 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SQL>  startup mount          --启动数据库到 mount 状态 
ORACLE instance started. 

Total System Global Area 1686925312 bytes 
Fixed Size                  2176368 bytes 
Variable Size             989858448 bytes 
Database Buffers          687865856 bytes 
Redo Buffers                7024640 bytes 
Database mounted. 

SQL> alter session set sql_trace=true; 
Session altered. 

SQL>  alter system enable restricted session; 
System altered. 

SQL> alter system set job_queue_processes=0; 
System altered. 

SQL> alter system set aq_tm_processes=0; 
System altered. 

SQL> alter database open; 
Database altered. 

SQL>  ALTER DATABASE character set INTERNAL_USE ZHS16GBK; --修改字符集AL32UTF8->ZHS16GBK 

Database altered. 

SQL> shutdown immediate;        --再次关闭数据库 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SQL> STARTUP             --启动数据库 
ORACLE instance started. 

Total System Global Area 1686925312 bytes 
Fixed Size                  2176368 bytes 
Variable Size             989858448 bytes 
Database Buffers          687865856 bytes 
Redo Buffers                7024640 bytes 
Database mounted. 
Database opened. 
SQL> select * from v$nls_parameters where parameter = 'NLS_CHARACTERSET';

/*分为四步 */
/*第1步:创建临时表空间  */
create temporary tablespace user_temp  
tempfile 'D:\oracle\oradata\Oracle9i\user_temp.dbf' 
size 50m  
autoextend on  
next 50m maxsize 20480m  
extent management local;  
 
/*第2步:创建数据表空间  */
create tablespace user_data  
logging  
datafile 'D:\oracle\oradata\Oracle9i\user_data.dbf' 
size 50m  
autoextend on  
next 50m maxsize 20480m  
extent management local;  
 
/*第3步:创建用户并指定表空间  */
create user username identified by password  
default tablespace user_data  
temporary tablespace user_temp;  
 
/*第4步:给用户授予权限  */
grant connect,resource,dba to username;

记录下,省得每次都去找了。

引用自:NetSQL