安裝oracle,中間錄入密碼,用戶是:sys,pass: 錄入的密碼。sql
鏈接數據庫,建議建立新的用戶,最好別直接用sys數據庫
安裝完畢,則須要配置Net Configration Assistant,才能經過pl/sql鏈接windows
確保服務監聽服務已經啓動session
解決方案:oracle
1) 找到監聽文件dom
C:\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.oraspa
打開:3d
# listener.ora Network Configuration File: C:\Oracle\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = WIN-L7MD6EPHO8Q.localdomain)(PORT = 1521)) ) ) ADR_BASE_LISTENER = C:\Oracle
修改成:code
# listener.ora Network Configuration File: C:\Oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = WIN-L7MD6EPHO8Q.localdomain)(PORT = 1521))
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = \product\11.2.0\dbhome_1)
(SID_NAME = orcl)
)
)
ADR_BASE_LISTENER = C:\Oracle
ORACLE_HOME: oracle安裝目錄blog
GLOBAL_DBNAME: 實例名,默認爲orcl
2) 重啓監聽器,固然能夠在windows服務中重啓
打開cmd,執行:
lsnrctl stop // 關閉 lsnrctl start // 啓動
解決方案:
一、SID_NAME改成具體的實例名,如:orcl
二、刪除 (PROGRAM = extproc)
# listener.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = orcl) (ORACLE_HOME = D:\oracle\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) SID_LIST_ORCL = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = D:\oracle\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.30.134)(PORT = 1521)) ) ) ADR_BASE_LISTENER = D:\oracle
四、imp還原數據庫時報錯:錯誤12514
IMP-00058: 遇到 ORACLE 錯誤 12514 ORA-12514: TNS: 監聽程序當前沒法識別鏈接描述符中請求的服務 IMP-00000: 未成功終止導入
注意導入的實例名是否正確,可參考上述解決方案。
第 1 行出現錯誤:
ORA-01940: 沒法刪除當前鏈接的用戶
說明,當前存在用戶的session.
解決方案:
一、首先查找session,肯定是那個進程引用
select username,sid,serial# from v$session
或者查詢增長用戶的過濾條件,只查該用戶的
select username,sid,serial# from v$session where username='DEMO'
二、殺死相應的session
alter system kill session'$sid,$serial';
三、強制刪除用戶
drop user demo cascade;
IMP-00003: 遇到 ORACLE 錯誤 959 ORA-00959: 表空間 'xxx' 不存在 IMP-00017: 因爲 ORACLE 錯誤 959, 如下語句失敗:
解決方案:
一、導入前,先建立表空間
create tablespace demo datafile 'D:\oracle\data\demo.dbf' size 100M autoextend on;
二、指定用戶該表空間不受限
alter user xxx quota unlimited on demo;//後面的demo是表空間名
三、而後再imp便可
注意導入時必定要指定log,便於分析解決