1.输入 sqlplus /nolog

2.将数据库启动到RESTRICTED模式下做字符集更改:

  1. SQL> conn /as sysdba
  2. --Connected.
  3. SQL> shutdown immediate;
  4. --Database closed.
  5. --Database dismounted.
  6. --ORACLE instance shut down.
  7. SQL> startup mount
  8. --ORACLE instance started.
  9. --Total System Global Area 236000356 bytes
  10. --Fixed Size 451684 bytes
  11. --Variable Size 201326592 bytes
  12. --Database Buffers 33554432 bytes
  13. --Redo Buffers 667648 bytes
  14. --Database mounted.
  15. SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
  16. --System altered.
  17. SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
  18. --System altered.
  19. SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
  20. --System altered.
  21. SQL> alter database open;
  22. --Database altered.
  23. SQL> ALTER DATABASE CHARACTER SET ZHS16GBK;
  24. --ALTER DATABASE CHARACTER SET ZHS16GBK
  25. --●
  26. --ERROR at line 1:
  27. --ORA-12712: new character set must be a superset of old character set
  28. --提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改:
  29. SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
  30. --Database altered.
  31. SQL> select * from v$nls_parameters;
  32. --略
  33. --19 rows selected.
  34. --重启检查是否更改完成:
  35. SQL> shutdown immediate;
  36. --Database closed.
  37. --Database dismounted.
  38. --ORACLE instance shut down.
  39. SQL> startup
  40. --ORACLE instance started.
  41. --Total System Global Area 236000356 bytes
  42. --Fixed Size 451684 bytes
  43. --Variable Size 201326592 bytes
  44. --Database Buffers 33554432 bytes
  45. --Redo Buffers 667648 bytes
  46. --Database mounted.
  47. --Database opened.