天天看點

這幾天使用Oracle的總結

如何建立表空間?

create tablespace test logging datafile 'D:\oracle\oradata\orcl\test.ora' size 50m autoextend on next 50m  maxsize unlimited extent  management local;

如何建立使用者?

create user username profile default default tablespace test;

如何給使用者賦相應的權限?

grant dba,connect,resource to username;

如何往建立的表空間裡導入dmp資料?

imp username/userpassword@orcl file=D:/oracle/oradata/some.dmp full=y ignore=y

相應的導出如何操作?

exp username/userpassword@orcl file=D:/oracle/oradata/outputdata.dmp owner=username

視圖的使用?發生視圖丢失???我完善的一個子產品其中的bug就是因為視圖的丢失

資料庫視圖丢失。

晚上11點,我的Oracle又發生了一些事情。過程是這樣的

白天我的項目部署後顯示的資料不完全,是以想回家重新導入資料。但是我把使用者相關的删除之後,删不掉ora檔案,是以我就到windows的服務裡關閉了所有的Oracle服務,然後把相關的ora檔案删除了。但是之後在登入重新建立表空間時,總是提示:ORA-01033:ORACLE initialization or shutdown in progresss即初始化或關閉正在進行中,登入不了。我啟動Oracle服務也不行,還是報這個錯誤!重新啟動也還是沒有作用,還是不行。

20120717Oracle使用報錯ora-01033 Oracle 初始化或關閉進行中

一下是網上搜尋的文章,成功解決了這個問題

在此之前需要先連接配接上資料庫

進入cmd指令模式,輸入指令sqlplus /NOLOG

進入到sqlplus模式,然後connect到Oracle用到的指令是

SQL>connect sys/change_on_install as sysdba 

提示:已成功 

使用一下指令删除相應的檔案就好了。

SQL> startup

ORACLE instance started.

Total System Global Area 914358272 bytes

Fixed Size 2088184 bytes

Variable Size 528483080 bytes

Database Buffers 377487360 bytes

Redo Buffers 6299648 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 8 - see DBWR trace file

ORA-01110: data file 8: '/var/opt/gssyneeadb/gssy_neeadb.dbf'

SQL> ALTER SYSTEM SET "_allow_resetlogs_corruption"=TRUE SCOPE=SPFILE;

System altered.

SQL> shutdown

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL> startup mount

SQL> alter database datafile '/var/opt/gssyneeadb/gssy_neeadb.dbf' offline drop;

Database altered.

Database opened.

SQL>

好使了。。。汗