方法:
創(chuàng)新互聯(lián)主營西寧網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app開發(fā),西寧h5微信平臺小程序開發(fā)搭建,西寧網(wǎng)站營銷推廣歡迎西寧等地區(qū)企業(yè)咨詢
1.?打開secureCRT,連接到數(shù)據(jù)庫所在的linux機(jī)器。若用戶為root,請輸入命令“su - oracle”并回車,若要密碼,輸入密碼后并回車,就切換到了oracle用戶下。
2.?關(guān)掉oracle的監(jiān)聽進(jìn)程:命令為“l(fā)snrctl stop”并回車,這時外部沒法連接到數(shù)據(jù)庫了。如圖有提示關(guān)閉成功信息。
3.先殺掉所有session,“ps -ef|grep $ORACLE_SID|grep -v ora_|grep LOCAL=NO|awk '{print $2}'|xargs kill”也可以用其他辦法。然后用sqlplus登錄到數(shù)據(jù)庫。命令依次為:“sqlplus /nolog”-“connect / as sysdba”?,最后用命令關(guān)閉oracle數(shù)據(jù)庫"shutdown immediate" 。關(guān)閉命令的時候需要等待點(diǎn)時間,成功后會有如圖的提示。
4.用命令"exit"退出sqlplus。然后用命令“l(fā)snrctl start”啟動數(shù)據(jù)庫的監(jiān)聽進(jìn)程。如圖提示語句表明啟動成功。
5.先用sqlplus登錄到數(shù)據(jù)庫。命令依次為:“sqlplus /nolog”-“connect / as sysdba”。然后輸入命令“startup”并回車。等待幾分鐘會出現(xiàn)如圖提示信息。最后用命令“exit”退出sqlplus。
方法/步驟 用CRT以安裝oracle數(shù)據(jù)庫的用戶連接oracle數(shù)據(jù)庫所在服務(wù)器。 (以服務(wù)器為linux 為例) 輸入命令: sqlplus /nolog ,進(jìn)入oracle控制臺,并輸入 conn /as sysdba;以DBA角色進(jìn)入。 連接成功后,輸入“select username from dba_users”
沒關(guān)系的,忘記密碼后可以通過sysdba用戶重新進(jìn)行密碼設(shè)置。 sql: conn /as sysdba;--用dba權(quán)限登錄 sql:alter user username identified by newpassword; --修改忘記密碼用戶的密碼 sql:conn username/newpassword;--用此用戶登錄。
cmd啟動Oracle數(shù)據(jù)庫
新建一個bat文件,復(fù)制內(nèi)容進(jìn)去,雙擊即可啟動.
?
1
2
3
4
@echo off
net start OracleXETNSListener 2nul
net start OracleServiceXE 2nul
@oradim -startup -sid XE -starttype inst nul 21
Oracle重置數(shù)據(jù)庫命令
新建bat文件,復(fù)制以下內(nèi)容,然后執(zhí)行。
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
@echo off
REM
REM The script assumes that user can connect using "/ as sysdba"
REM
REM =================
REM Restore procedure
REM =================
REM
REM If Installed Oracle home is also lost and oracle binaries were
REM re-installed or the Oracle is installed to new oracle home location
REM compared to backup time, then user will be prompted to enter Flash
REM Recovery Area location.
REM
REM For database in NoArchiveLog mode, database is restored to last offline
REM backup time/scn;
REM For database in Archive log mode, database is restored from last backup
REM and a complete recovery is attempted. If complete recovery fails,
REM user can open the database with resetlogs option provided the files
REM are not recovery fuzzy.
REM
REM The restore log is saved in ?/DATABASE/OXE_RESTORE.LOG
REM
setlocal
set /p inp="This operation will shut down and restore the database. Are you sure [Y/N]?"
:checkinp
if /i "%inp%" == "Y" goto :confirmedyes
if /i "%inp%" == "n" exit
:Askagain
set /p inp=
goto :checkinp
:confirmedyes
echo Restore in progress...
echo db_name=xe %temp%\rman_dummy.ora
echo sga_target=270M %temp%\rman_dummy.ora
net start oracleserviceXe
REM Startup database in nomount mode using RMAN...
@(
echo set echo on^;
echo startup nomount pfile=%temp%\rman_dummy.ora force^;
) %temp%\restore_rman0.dat
rman target / @%temp%\restore_rman0.dat
if not %errorlevel% == 0 set Errorstr= RMAN Error - could not startup dummy instance goto :restorefailederr
@(
echo connect / as sysdba^;
echo set head off
echo set echo off
echo set linesize 515
echo variable var varchar2^(512^)^;
echo execute :var := sys.dbms_backup_restore.normalizefilename^(^'SPFILE2INIT^'^)^;
echo spool %temp%\spfile2init.log
echo select sys.dbms_backup_restore.normalizefilename^(^'SPFILE2INIT.ORA^'^) spfile2init from dual^;
echo exit^;
) %temp%\spfile2init.sql
sqlplus /nolog @%temp%\spfile2init.sql nul
FOR /F %%i in (%temp%\spfile2init.log) do set SPFILE2INIT=%%i
@(
echo connect / as sysdba;
echo set head off
echo set echo off
echo set linesize 515
echo variable var varchar2^(512^)^;
echo execute :var := sys.dbms_backup_restore.normalizefilename^(^'FRA_LOC^'^)^;
echo spool %temp%\restore_rmanlog.log
echo select sys.dbms_backup_restore.normalizefilename^(^'OXE_RESTORE.LOG^'^) RESTORE_RMANLOG from dual^;
echo exit^;
) %temp%\restore_rmanlog.sql
sqlplus /nolog @%temp%\restore_rmanlog.sql nul
FOR /F %%i in (%temp%\restore_rmanlog.log) do set RESTORE_RMANLOG=%%i
if not exist ^"%SPFILE2INIT%^" goto get_rcvarea_loc
@(
echo set echo on^;
echo shutdown immediate^;
echo startup nomount pfile=^"%SPFILE2INIT%^"^;
echo restore ^(spfile from autobackup^) ^(controlfile from autobackup^)^;
echo startup mount force^;
echo configure controlfile autobackup off^;
echo restore database^;
) %temp%\restore_rman1.dat
rman target / @%temp%\restore_rman1.dat trace "%RESTORE_RMANLOG%"
if not %errorlevel% == 0 set Errorstr= RMAN Error - See log for error goto :restorefailederr
goto restored_files
:get_rcvarea_loc
set /p rcvarea_loc="Enter the flash recovery area location:"
@(
echo set echo on^;
echo restore ^(spfile from autobackup db_recovery_file_dest=^'%rcvarea_loc%^'^)^;
echo startup nomount force^;
echo restore ^(controlfile from autobackup^)^;
echo alter database mount^;
echo configure controlfile autobackup off^;
echo restore database^;
) %temp%\restore_rman1.dat
rman target / @%temp%\restore_rman1.dat trace "%RESTORE_RMANLOG%"
if not %errorlevel% == 0 set Errorstr= RMAN Error - See log for error goto :restorefailederr
goto restored_files
:restored_files
@(
echo connect / as sysdba^;
echo declare cursor n1 is select name from v$tempfile^;
echo begin
echo for a in n1
echo loop
echo begin
echo sys.dbms_backup_restore.deletefile^(a.name^)^;
echo exception
echo when others then
echo null^;
echo end^;
echo end loop^;
echo end^;
echo /
echo exit^;
echo /
) %temp%\deltfile.sql
sqlplus /nolog @%temp%\deltfile.sql nul
@(
echo connect / as sysdba^;
echo set head off
echo set echo off
echo spool %temp%\logmode.log
echo select log_mode from v$database^;
echo exit^;
) %temp%\logmode.sql
sqlplus /nolog @%temp%\logmode.sql nul
FOR /F %%i in (%temp%\logmode.log) do set LOGMODE=%%i
if "%LOGMODE%" == "NOARCHIVELOG" goto process_noarchivelog
if "%LOGMODE%" == "ARCHIVELOG" goto process_archivelog
set Errorstr= Unknown log mode : %LOGMODE%
goto :restorefailederr
:process_noarchivelog
@(
echo set echo on^;
echo alter database open resetlogs;
) %temp%\restore_rman2.dat
rman target / @%temp%\restore_rman2.dat trace "%RESTORE_RMANLOG%" append
if not %errorlevel% == 0 set Errorstr= RMAN Error - See log for details goto :restorefailederr
goto :restoresucess
:process_archivelog
@(
echo set echo on^;
echo recover database^;
echo alter database open resetlogs;
) %temp%\restore_rman2.dat
rman target / @%temp%\restore_rman2.dat trace "%RESTORE_RMANLOG%" append
if not %errorlevel% == 0 set Errorstr= RMAN Error - See log for details goto :restorefailederr
goto :restoresucess
:restoresucess
echo Restore of the database succeeded.
echo Log file is at %RESTORE_RMANLOG%.
pause Press any key to exit
exit
goto :EOF
:restorefailederr
echo ==================== ERROR =============================
echo Restore of the database failed.
echo %Errorstr%.
echo Log file is at %RESTORE_RMANLOG%.
echo ==================== ERROR =============================
pause Press any key to exit
exit
goto :EOF
網(wǎng)頁名稱:oracle如何重置指令 oracle重啟命令詳解
網(wǎng)頁地址:http://chinadenli.net/article6/hgocig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站、面包屑導(dǎo)航、、定制開發(fā)、虛擬主機(jī)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)