linux 备份 oracle,linux恢复出厂命令

Oracle冷备份

冷备份发生在数据库已经正常关闭的情况下当正常关闭时会提供给我们一个完整的数据库

冷备份是将关键性文件拷贝到另外位置的一种做法对于备份Oracle信息而言冷备份是最快和最安全的方法值得注意的是冷备份必须是数据库关闭的情况下完成当数据库开着的时候执行数据库文件系统备份无效

冷备份所需备份的文件包括以下几种

所有数据文件

所有控制文件

所有联机REDO LOG文件

INIT<sid> ORA文件(可选)

冷备份的步骤

正常关闭要备份的实例(instance)

备份整个数据库到一个目录

启动数据库

用冷备份进行数据库恢复

如果数据库是运行在非归档日志模式下将备份文件拷贝回原来的目录即可非归档日志模式下数据库只能恢复到备份时刻的状态

如果数据库是运行在归档日志模式下将数据文件拷回原来的目录(不包括联机redolog文件)然后依次选择相应的重做日志文件进行恢复即可恢复冷备份后的所有操作即是说可以恢复到系统崩溃前的状态

冷备份示例

示例一 windows环境下的冷备份与恢复

在本例中数据库实例名wh所有数据文件所有控制文件和所有联机REDO LOG文件都在文件夹D:\oracle\ora \wh中备份恢复的操作如下

进入 sql*plus以sysdba的身份登录数据库

SQL>sys/oracle@wh as sysdba

关闭数据库SQL>shutdown immediate

拷贝D:\oracle\ora \wh到目标备份目录E:\bacakupora\wh

数据库冷备份完成下面对数据库中的内容进行更改

启动数据库

SQL>startup

删除数据

SQL>delete from wh test(删除某个用户的表)

此时进行数据库恢复

SQL>shutdown immediate;

拷贝目标备份目录E:\bacakupora\wh到D:\oracle\ora \wh

数据库恢复完毕通过查询可以发现数据库恢复到进行备份时刻的状态备份后所进行的所有操作无效

示例二 linux环境下的冷备份与恢复

在本例中数据库实例名urpdb所有数据文件存放在\oradata\urpdb目录下所有控制文件和所有联机REDO LOG文件都在文件夹opt\ora \oradata\urpdb中备份恢复的操作如下

sys/oracle@urpdb as sysdba进入sql*plus;

SQL>shutdown immediate(保持所有数据文件在时间点上的一致性)

拷贝\oradata\urpdb和opt\ora \oradata\urpdb下的所有文件到新的备份目录

假设进行如下操作

SQL>startup

SQL>create table test(c number() c varcharc());

SQL>insert into text values( a);

SQL>mit;

此后假设有一个数据文件坏了然后将备份的所有文件包括联机重做日志文件拷贝回来

SQL>shutdown immediate;

拷贝文件包括联机重做日志文件

SQL>startup;

lishixinzhi/Article/program/Oracle/201311/16503

...Linux系统上安装和配置Backup Exec 12.5 Oracle Agent

BE11d的Oracle Agent与以前的版本有本质的不同,它采用RMAN来备份Oracle数据库,也支持Linux系统上的Oracle数据库,很多用户对它的配置还不熟悉,特别是在Linux系统上的配置,下面是我所做的一个配置实例。中文部分是我加的说明。

[root@ora10g lib]#/opt/VRTSralus/bin/AgentConfig//安装好RALUS之后,请使用root用户来配置代理程序。

Symantec Backup Exec Remote Agent UtilityChoose one of the following options:

1. Configure database access

2. Configure Oracle instance information

3. Quit

Please enter your selection: 1//要完成两个部分的配置,数据库访问和Oracle实例,下面先配置数据库访问。

Configuring machine information

Choose one of the following options:

1. Add system credentials for Oracle operations2. Edit system credentials used for Oracle operations3. Remove system credentials used for Oracle operations4. View system credentials used for Oracle operations5. Quit

Please enter your selection: 1//添加新的Linux系统级访问凭据。

Enter a user name that has local system credentials: oracle// Oracle是Linux上面的用户,它必须是beoper组的成员。usermod-G将用户加入多个组//usermod–G groupusernameEnter the password:

Re-enter password:

Validating credentials.......

Do you want to use the full computer name/IP address for Oracle operations?(Y/N):n//指定名字的好处是,避免因为计算机名字或IP地址的变化导致Recovery Catalog中的记录信息混乱。

Do you want to use a custom port to connect to the media server during Oracle operations?(Y/N): n//默认的端口号是5633,建议不要改动它,除非这个端口己经被其它应用程序占用,如果这里做出了改变,介质服务器端也要做同样的修改。

Commit Oracle operation settings to the configuration file?(Y/N): ySUCCESS: Successfully added the entry to the configuration file.

//上述配置中的计算机名(如果没有指定就是在介质服务器上连接这台机器时所使用的名字或IP地址),用户名和密码必须也介质服务器全局选项中Oracle选项页中配置的为Oracle和DB2所设置的验证信息完全一致。

Configuring machine information

Choose one of the following options:

1. Add system credentials for Oracle operations2. Edit system credentials used for Oracle operations3. Remove system credentials used for Oracle operations4. View system credentials used for Oracle operations5. Quit

Please enter your selection: 5

Symantec Backup Exec Remote Agent UtilityChoose one of the following options:

1. Configure database access

2. Configure Oracle instance information

3. Quit

Please enter your selection: 2//下面来配置Oracle实例信息。

If this computer is a RAC node, you must perform additional steps for configuration before you continue. Refer to the readme for these additional steps.

Configuring the Oracle Agent

Choose one of the following options:

1. Add a new Oracle instance to protect

2. Edit an existing Oracle instance

3. Delete an existing Oracle instance

4. View Oracle instance entries that have been added in the Remote Agent Utility5. Quit

Please enter your selection: 1

Select an Oracle instance to configure

Entry 1. orcl//如果RALUS检测到了系统中的Oracle实例,实例名会列在这里供用户选择,如果你的实例名没有出现在这里,请检查Listener和数据库的状态。

Enter the number 0 to go back

Enter your selection: 1

Enter the Oracle database SYSDBA user name: sys// Oralce DBA的账号,推荐使用sys。

Enter the Oracle database SYSDBA password:

Re-enter password:

Validating credentials.......

Enter the media server name or IP address: be11d//这里输入介质服务器的名字Do you use a recovery catalog?(Y/N):n//如果你己经安装好了用做Recovery Catalog的实例并做了初始化,就在这里输入实例名和登录账号,如果没有Recovery Catalog就选n,RMAN编录信息将被写入控制文件。

Do you want to use a customized job template?(Y/N): n//这里不需要定义作业模板名,因为你在RMAN脚本中可以使用send“NBBSA_JOB_TEMPLATE=模板名”命令为每个备份指定不同的模板名,当然你要预先在介质服务器端创建好这个模板。

Commit Oracle operation settings to the configuration file?(Y/N): yRenamed file/u01/app/oracle/oracle/product/10.2.0/db_1/lib/libobk.so to/u01/app/oracle/oracle/product/10.2.0/db_1/lib/libobCreated symbolic link for/opt/VRTSralus/bin/libobk.so at/u01/app/oracle/oracle/product/10.2.0/db_1/lib/libobk.so//配置向导在Oracle数据库的库文件目录下将libobk.so链接到RALUS的文件,BE接管了RMAN向磁带机写入数据的备份接口,RMAN向 sbt或sbt_tape设备写入数据时,RALUS会把数据传送到介质服务器。

SUCCESS: Successfully added the entry to the configuration file.

Configuring the Oracle Agent

Choose one of the following options:

1. Add a new Oracle instance to protect

2. Edit an existing Oracle instance

3. Delete an existing Oracle instance

4. View Oracle instance entries that have been added in the Remote Agent Utility5. Quit

Please enter your selection: 5

Symantec Backup Exec Remote Agent UtilityChoose one of the following options:

1. Configure database access

2. Configure Oracle instance information

3. Quit

Please enter your selection: 3

[root@ora10g lib]#/etc/init.d/VRTSralus.init start//配置完成,启动RALUS。

Starting Symantec Backup Exec Remote Agent......

Starting Symantec Backup Exec Remote Agent: [ OK ]

##################################################################################安装代理

安装文档

配置agent

主要文件为ralus.cfg这里注意配置格式,需要将media server改为BE server的hostname或者IP address,1. From the/etc/VRTSralus/ directory, open the RALUS.CFG file using a text editor2. To add additional media servers, add the following line:

SoftwareVERITASBackup ExecEngineAgentsAgent Directory List<Suffix>=<Media Server Name>

where<Suffix> is a UNIQUE identifier,'A','B','C','1','2','3', and where<Media Server Name> is the name or IP address of the Backup Exec 10.x media server.

远程备份oracle9数据库报错EXP-00056 ORA-12560

EXP-00056和ORA-12560错误都与Oracle数据库连接相关,可能是由于连接配置不正确或数据库实例无法访问导致的。以下是一些可能的解决方法:

确保TNS名称解析正确:请检查TNSNAMES.ORA文件中的连接配置是否正确,确保TNS别名和实例名称匹配。可以使用tnsping命令测试TNS别名是否能够正确解析到数据库实例。

2.检查Oracle监听器是否正常:可以使用lsnrctl命令来检查Oracle监听器的状态。如果监听器未启动,请使用命令“lsnrctl start”启动监听器。

3.检查Oracle服务是否正在运行:在Windows系统上,可以使用服务管理器(services.msc)检查Oracle服务是否正在运行。在Linux/Unix系统上,可以使用ps命令来检查Oracle进程是否正在运行。

4.检查Oracle账号和密码是否正确:请确保使用的Oracle账号和密码是正确的,可以使用sqlplus命令测试账号和密码是否能够正确登录到数据库。

5.检查防火墙和网络连接:如果Oracle数据库和备份服务器不在同一个网络中,可能需要在防火墙中打开相关端口。此外,网络连接也可能存在问题,可以使用ping命令测试数据库和备份服务器之间的网络连通性。

希望这些解决方法能够帮助你解决问题。如果问题仍然存在,请提供更多的详细信息,以便我能够提供更精确的建议。

望采纳~

谢谢!

阅读剩余
THE END