Index
For example: ORA-01659
#> oerr ora 1659
For example: IMP-00032
#> oerr imp 32
可能 trc log 在刪除時仍處於開啟狀態,執行 lsof 確認
lsof | grep deleted or lsof +L1 oracle 2086 oracle 7u REG 252,2 0 0 154946 /opt/oracle/product/10.2.0/db_1/dbs/lkinstoddfdc (deleted) oracle 2108 oracle 5w REG 252,5 725 0 32796 /opt/oracle/admin/oddfdc/udump/oddfdc_ora_2051.trc (deleted) oracle 2108 oracle 7u REG 252,2 0 0 154946 /opt/oracle/product/10.2.0/db_1/dbs/lkinstoddfdc (deleted) oracle 14600 oracle 5w REG 252,5 725 0 32796 /opt/oracle/admin/oddfdc/udump/oddfdc_ora_2051.trc (deleted) oracle 14600 oracle 7u REG 252,2 0 0 154946 /opt/oracle/product/10.2.0/db_1/dbs/lkinstoddfdc (deleted) oracle 20307 oracle 5w REG 252,5 2447898873 0 69138 /opt/oracle/admin/oddfdc/udump/oddfdc_ora_20307.trc (deleted)
解決:
不停機)
#> cd /proc/20307/fd #> ls -ltr total 0 lr-x------ 1 oracle dba 64 Jun 25 09:00 9 -> /opt/oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb lr-x------ 1 oracle dba 64 Jun 25 09:00 8 -> /opt/oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb lr-x------ 1 oracle dba 64 Jun 25 09:00 7 -> /dev/zero lr-x------ 1 oracle dba 64 Jun 25 09:00 6 -> /dev/null l-wx------ 1 oracle dba 64 Jun 25 09:00 5 -> /opt/oracle/admin/oddfdc/udump/oddfdc_ora_20307.trc (deleted) lr-x------ 1 oracle dba 64 Jun 25 09:00 4 -> /dev/null lr-x------ 1 oracle dba 64 Jun 25 09:00 3 -> /dev/null lrwx------ 1 oracle dba 64 Jun 25 09:00 2 -> /dev/null lrwx------ 1 oracle dba 64 Jun 25 09:00 12 -> socket:[156468667] lrwx------ 1 oracle dba 64 Jun 25 09:00 1 -> /dev/null lrwx------ 1 oracle dba 64 Jun 25 09:00 0 -> /dev/null #> cat /dev/null > 5
或
DB 執行重啟
新安裝的資料庫,啟動後一直產生 *.trc 在目錄 /opt/oracle/admin/sid/bdump
解決:檢查 /etc/hosts 與 hostname 是否有一致的電腦名稱設定。
檔案名稱:
[root@tangodb oracle]# ls -l /opt/oracle/product/9.2/dbs | more total 16547624 -rw-r----- 1 oracle oinstall 2211840 Jan 1 2012 c-511617224-20120101-04 -rw-r----- 1 oracle oinstall 2211840 Jan 1 2012 c-511617224-20120101-05 -rw-r----- 1 oracle oinstall 2211840 Jan 1 2012 c-511617224-20120101-06 -rw-r----- 1 oracle oinstall 2211840 Jan 1 2012 c-511617224-20120101-07 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-00 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-01 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-02 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-03 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-04 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-05 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-06 -rw-r----- 1 oracle oinstall 2211840 Jan 2 2012 c-511617224-20120102-07 ...
解決:
解決:這是系統的語言設定與 DB 的設定不符
#> export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 再執行一次 exp
DB 本機端可以登入,但從遠端的 OEM 使用 SYS 登入,會遭遇這個錯誤訊息。
解決:
確認以下兩個方式
SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP ------------------------------ ----- ----- SYS TRUE TRUE <=== 沒有這一行
$> ls $ORACLE_HOME/dbs 找不到 orapw<SID> 的檔案
重建/新增 SYS 密碼檔
$> $ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwoddfdc password='oracle' force=y
使用下列方式可強制關閉 DB
$ sqlplus -prelim "/ as sysdba" SQL> shutdown abort
匯出單一 Table 時出現錯誤:
EXP-00056: ORACLE error 1555 encountered
ORA-01555: snapshot too old: rollback segment number with name "" too small
這 Table 有包含 CLOB type。
檢查 UNDO 參數
SQL> show parameter undo NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ undo_management string AUTO undo_retention integer 900 undo_tablespace string UNDOTBS1
Solution:
NOTE:
如果 #1 無法執行,就選擇 #2
如果 #2 沒有幫助,就繼續 #3
參考連結:
當匯入資料庫完畢後,出現這個錯誤。
IMP-00041: Warning: object created with compilation warnings
"CREATE FORCE VIEW "WIN_FDC_STDB"."PROCSPECIAL_700464"
....
或者檢查 OEM GUI > Schema > Views
有些項目的狀態會顯示 Invalid
Invalid Object (View, Package, Trigger,...)
這是一個發生在資料庫匯入後的常見錯誤,發生的問題可能有兩種
IMP-00041: Warning: object created with compilation warnings "CREATE FORCE VIEW 或者 IMP-00041: Warning: object created with compilation warnings "CREATE TRIGGER
Ans:必須重新編譯出現 Invalid 的物件
列出 Invalid 物件
COL owner FORMAT A20 COL object_type FORMAT A10 COL object_name FORMAT A30 SELECT owner, object_type, object_name, status FROM dba_objects WHERE status = 'INVALID' ORDER BY owner, object_type, object_name;
a.手動編譯單一個物件,例如 WIN_FDC_STDB.PROCSPECIAL_700464
SQL> alter view WIN_FDC_STDB.PROCSPECIAL_700464 compile; NOTE: alter <object-type> <object-name> compile;
編譯完後,如果沒有出現任何錯誤,檢查 OEM GUI 的狀態,應該要顯示 Valid。
b.編譯多個物件時
使用 utlrp.sql & utlprp.sql
SQL> @?/rdbms/admin/utlrp.sql
c.編譯指定 Schema 的所有物件
SQL> connect system/yourpass SQL> exec dbms_utility.compile_schema('SCOTT');
TIP:
執行 dbms_utility.compile_schema 時必須使用 system 帳號,否則會遇到以下錯誤:
ORA-24237: object id argument passed to DBMS_UTILITY.INVALIDATE is not legal重新編譯物件的方式,除了以上所列以外,還有更多其他的方式,請參閱 http://www.oracle-base.com/articles/...ma-objects.php
Table Name 如果包含有小寫,執行任何 SQL 時會出現這個錯誤。
Ans:所有 Table Name 應該都是要大寫,如果不小心出現小寫,可以用雙引號。
狀況一:Table 一般操作
SQL> select count(*) from CATEGORYDEF_copy; select count(*) from CATEGORYDEF_copy * ERROR at line 1: ORA-00942: table or view does not exist SQL> select count(*) from "CATEGORYDEF_copy"; COUNT(*) ---------- 0
狀況二:匯入/匯出 Tables 時,在 parfile 的檔案內容參考如下
directory=dmp_dir dumpfile=exp_WIN_FDC_STDB_small_tables.dmp logfile=exp_WIN_FDC_STDB_small_tables.log tables=\"WIN_FDC_STDB\".\"CATEGORYDEF_copy\"
Ans:
SQL> exec dbms_stats.gather_schema_stats('schema-name', cascade=>TRUE);
Ans:調整變數的長度,例如
var tbs_source varchar2; 改成 var tbs_source varchar2(100);
當 Oracle Enterprise Manager(OEM) 安裝在 Windows 7 時,如果使用非 Administrator 帳戶開啟 OEM 後,在啟動資料庫連線時,OEM 視窗會強制跳離,並且若在 CMD 模式執行 sqlplus 會出現這個錯誤訊息。
解決方式:
建立 Tablespace,將 BLOCKSIZE=16M 時,出現這個錯誤。
Ans: 解決方法是修改系統參數 db_16k_cache_size,DB 不用重啟
SQL> alter system set db_16k_cache_size=16M scope=both;
Ans:
檢查是否使用 ASMM
SQL> show parameters statistics_level VALUE = TYPICAL SQL> show parameters sga_target VALUE > 0 SQL> show parameters shared_pool_siz VALUE = 0 SQL> show parameters db_cache_size VALUE = 0
檢查目前系統的 shared memory
$ ipcs -lm ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 3145728 max total shared memory (kbytes) = 3670016 min seg size (bytes) = 1
TIPs:
所有 DB Instances 的 sga_target 總合必須小於 max total shared memory,如果大於,會造成其中一個 DB 無法啟動,並且顯示錯誤為
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
要調整 max total shared memory,可以修改 /etc/sysctl.conf
kernel.shmall = XXXX
這裡的單位是 page,預設的 page size 是 4096 byte,定義在 kernel.shmmni
調整 DB 系統參數
--Backup old spfile first show parameters spfile CREATE pfile='/path/to/pfile.tmp' FROM spfile='/path/to/spfile.ora' CREATE spfile='/path/to/spfile.ora.20140313' FROM pfile='/path/to/pfile.tmp' alter system set sga_max_size=4096M scope=spfile; alter system set sga_target=4096M scope=spfile; shutdown immediate; startup;
ORA-39082: Object type VIEW:"WINSTDB"."V_PROCDEF_FDS_700464" created with compilation warnings
Ans: 匯入資料庫時,如果 source-owner 與 target-owner 不一樣,就可能這個問題,即使匯入指令時使用了 remap,但遇到某些 VIEW 或其他物件,原有 source-owner 識別並不會正確的 remap,所以針對這些物件錯誤,必須手動新增它們,例如重新建立 VIEW 等等
Solution: 由於匯入 log 出現的都是 VIEW 物件的錯誤,所以從 GUI 檢視 VIEW,發現有許多個 VIEW 的狀態出現 invalid,再次檢視這些 VIEW 的內容,發現 OWNER 還是 source 端的,所以執行以下 SQL 修正這些錯誤的 VIEW:
修正 VIEW:
SQL> create or replace view WINSTDB.V_PROCDEF_FDS_700397 as SELECT "SYSID","VARIABLENAME","DEFTABLE","DEFFIELD","COLLAPSABLE" FROM ( SELECT 'MAT03__FDS' AS SYSID FROM DUAL ) IDT, ( SELECT * FROM WINSTDB.PROCDEF_FDS_700397 WHERE VARIABLENAME NOT IN ('Step', 'StepLabel', 'Message') ) VART; SQL> alter view WINSTDB.V_PROCDEF_FDS_700397 compile;
檢查是否有物件的 status 是呈現 INVALID:
SQL> select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from all_objects where status='INVALID';
更多物件的編譯指令:
SQL> ALTER PACKAGE <SchemaName>.<PackageName> COMPILE; SQL> ALTER PACKAGE <SchemaName>.<PackageName> COMPILE BODY; SQL> ALTER PROCEDURE my_procedure COMPILE; SQL> ALTER FUNCTION my_function COMPILE; SQL> ALTER TRIGGER my_trigger COMPILE; SQL> ALTER VIEW my_view COMPILE;
Ans: 當執行到這個步驟時,整個系統出現 hang 問題
ORA-39083: Object type INDEX_STATISTICS failed to create with error
Solution:
方法一:impdp 加上 EXCLUDE=statistics
$ impdp system SCHEMAS=<source-owner> REMAP_SCHEMA=<source-owner>:<target-owner> table_exists_action=replace DIRECTORY=dmp_dir DUMPFILE=expdp_SOURCE_OWNER.dmp LOGFILE=impdp_TARGET_OWNER.log EXCLUDE=statistics $ sqlplus / as sysdba SQL> exec dbms_stats.gather_schema_stats('<target-owner>');
Ans: 在 OEM UI(Java)操作下無法刪除 datafile,但可以用指令方式來作
SQL> alter tablespace <tablespace-name> drop datafile '/opt/oracle/oradata/win/STDB03.dbf';
Ans: 解決步驟如下:
如果連 SQL/PLUS 都無法有效被執行時,如何能強制關閉資料庫
$sqlplus -prelim "/ as sysdba" SQL> shutdown abort
移除 User 所屬的物件
set heading off set pages 0 set feedback off set echo off spool ./drop_MYUSER.sql select 'drop table MYUSER.'||table_name||';' from dba_tables where owner='MYUSER'; spool off
移除 User
drop user USER CASCADE;
Ans: Add a option buffer=1000000 in the import command
#> imp system/oracle buffer=1000000 .....
If it's still not working, try to find out the proper value of the SQL_LENGTH with the following command:
In the source DB you need to run
SQL> select dbms_lob.getlength (dbms_metadata.get_ddl('TABLE','<table-name>','<owner-name>')) "SQL_LENGTH" from dual; SQL_LENGTH ---------- 71203
NOTE: the table name can be one of the tables failed on import.
Ans: Solution
Images 0 | ||
---|---|---|
No images to display in the gallery. |