oracle重置口令是什么意思,Oracle重置数据库命令
新建bat文件,复制以下内容,然后执行。
@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
oracle重置口令是什么意思,Oracle重置数据库命令相关推荐
- oracle scn 重置,学习笔记:Oracle SCN详解 SCN与Oracle数据库恢复的关系
天萃荷净 分享一篇关于Oracle SCN的详解,介绍SCN与Oracle数据库恢复的关系和SCN在数据库中的作用 一.为什么需要System checkpoint SCN号与Datafile Che ...
- Oracle的口令文件(passwordfile)的讲解(摘录)
初学oracle,很多概念迷糊,今天看到这文章,让我有一个比较清晰的认识. 转载[url]http://www.itpub.net/viewthread.php?tid=906008&extr ...
- oracle启动文件是什么意思,Oracle数据库的启动——口令文件的作用
在Oracle 10g之前,启动到Mount状态,数据库需要具备的另外一个重要文件是口令文件,在Unix/Linux上,该文件位于$ORACLE_HOME/dbs目录下,缺省的名称为orapw. 而在 ...
- oracle 数据库口令,oracle的口令资料
oracle的口令文件 Oracle中的口令文件存放着系统的特权用户(sysdba, sysoper)用户的用户名及口令,允许用户通过口令文件验证,在数据库未启动之前登陆从而启动数据库.如果没有口令文 ...
- oracle常用口令
1. Oracle安装完成后的初始口令? internal/oracle sys/change_on_install system/manager scott/tiger sysman/oe ...
- oracle的口令就是密码吗,如何修改Oracle用户的密码(不改变原密码)
如何修改Oracle用户的密码 有的人回答说这个不是很简单吗 alter user identified by +密码 如果不知道用户的密码情况下,不能改变原始密码呢(适用于用户密码过期) 测试如下 ...
- 总结一:Oracle 数据库命令总结
一.日志管理 1.强制日志切换(forcing log switches) alter system switch logfile;2.强制执行检查点(forcing checkpoints) alt ...
- Oracle 数据库命令个人总结
一.日志管理 1.强制日志切换(forcing log switches) alter system switch logfile;2.强制执行检查点(forcing checkpoints) alt ...
- oracle 配置账户密码是多少,【ORACLE】oracle数据库用户密码复杂度配置
-- 设置密码复杂度 SQL> @ /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/utlpwdmg.sql -- 测试 SQL> alte ...
- oracle中imp命令详解,ORACLE EXPDP IMPDP数据导入导出命令详解及同EXP IMP命令详细对照...
ORACLE EXPDP IMPDP数据导入导出命令详解及同EXP IMP 命令详细对比 一.EXPDP IMPDP EXP IMP 可以实现 1.可以实现逻辑备份和逻辑恢复 2.可以在数据库用户之间 ...
最新文章
- NLP文本生成模型数据准备及实战
- 利用tab_control控件在对话框中加入属性页的方法详细介绍
- 将protobuf文档转换成java代码
- 跨部门不配合工作_跨部门协作,队友总是“甩锅”,这三个方法教你快速避坑!...
- notepad++ 偶数行_C ++程序查找前N个偶数的立方和
- Mysql for Linux安装配置之——二进制安装
- shell waite php,linux shell wait命令详解
- Vue3.0 + Ts 项目框架搭建二:路由 Router
- Apache OpenNLP提供的文档
- CentOS7安装GNOME可视化界面 和 远程访问
- PMP考试通关宝典-敏捷专题
- 主动轮廓线模型Snake模型简介amp;openCV中cvSnakeImage()函数代码分析
- 一种便携式导弹飞控系统外场实时仿真测试系统设计
- VB中产生10个不重复的随机数
- SSH登录的两种方式
- 佳能mp288打印机连供系统使用
- vue3 项目中如何输出webpack的config.js
- 低市值高业绩的TCL,能否借“元宇宙”风口说新故事?
- 微信小程序界面设计的好方法
- vue打包上线部分css效果错乱,解决Vue打包上线之后部分CSS不生效的问题