12、备份与恢复ing
连接目标数据库: 1、运行命令中输入:rman target sys/nocatalog。 2、rman命令后:connect target sys/password@127.0.0.1/orcl --@后跟网络地址访问远程数据库。 dos控制台中输入:show all; 查看RMAN配置参数。 通过configure命令修改参数(通过clear 关
连接目标数据库:
1、运行命令中输入:rman target sys/nocatalog。
2、rman命令后:connect target sys/password@127.0.0.1/orcl --@后跟网络地址访问远程数据库。
dos控制台中输入:show all; 查看RMAN配置参数。
通过configure命令修改参数(通过clear 关键字恢复默认值)
configure retention policy clear; --恢复默认
list backup of database; --查看建立的备份集和备份片段。
list backup of tablespace tablespace_name; --表空间备份信息查看。
list backup of controlfile; --控制文件的备份信息。
list backup of archivelog all; --归档日志文件备份信息。
一、备份
1、手动分配通道
rman中输入脚本
run{
allocate channel ch1 device type disk
format='d:\oracle_bak\rmanBakTest\Jangle_%Y_%M_%D'
backup tablespace jangle channel ch1;
}
2、自动分配通道
backup tablespace jangle;
输入该命令后,会依据RMAN配置的参数进行备份。11g的默认路径是
:\app\jangle\flash_recovery_area\orcl\BACKUPSET\2016_04_25
它会在闪回目录中建立实例名文件夹,再建立backupset文件夹,在该文件夹下面再建立日期文件夹。
backup [database|tablespace tbs_name] {format='d:\...'} --全数据库的备份
3、在未关闭数据库的时候做的备份,还需要再把当前的重做日志进行归档
sql'alter system archive log current'; --在rman中的命令。
4、备份控制文件
backup current controlfile;
也可以通过include current controlfile子句添加至备份数据库或者表空间的后面:
backup tablespace tbs_name include current controlfile;
list backup of controlfile; --查看控制文件备份信息
5、备份归档重做日志
backup archivelog all { delete all input}; --{}中增加后,在备份完成后会删除归档重做日志。
backup archivelog from time 'sysdate-8' until time 'sysdate-1'; --对一周前的归档日志进行备份。
list backup of archivelog all; --查看归档日志备份信息。
也可以通过plus archivelog子句添加至备份数据库或者表空间的后面,进行归档重做日志的备份:
backup database plus archivelog;
综合:
backup [database|tablespace tbs_name] include current controlfile plus archivelog;--备份数据库或者表空间同时备份其控制文件与归档日志文件。
6、多重备份(即备份多份放到不同的目录(磁盘))
backup copies 2 tablespace jangle
format 'D:\..bk_%d_%c.bak','D:\..bk_%d_%c.bak'; --其中tablespace jangle 可以替换为database。
7、增量备份
backup incremental level=0 [cumulative]
format 'D:\\...%Y_%M_%D_%c.bak'
tablespace jangle; --cumulative指定为累积增量备份。不指定为差异增量备份。0级为第一次备份,完全备份。
差异增量备份:备份基础为同级别或低一级的先前备份。
累积增量备份:备份基础为低一级的先前备份(故累积备份占用的存储会多些,但还原的速度比差异增量备份要快。)
注:在非归档模式下,只能关闭数据库后才能进行增量备份。
二、恢复
restore [database|tablespace tbs_name|datafile]; --对于非归档模式的数据库,仅能还原先前备份的数据库。
recover [database|tablespace tbs_name |datafile]; --对于归档模式的数据库,这还原后还需要进行恢复操作。此处将使用归档日志对其进行数据恢复,从而恢复至数据库损坏时的状态。
除此之外还有:
restore [ controlfile to | archivelog all ]; --还原控制文件,归档日志文件。(一般通过复合控制文件进行容灾,可不再进行备份。)
2.1、基于事件的不完全恢复
将数据库恢复到某个指定时间前的状态。
1、先进行脱机备份(关闭数据库),备份控制文件的所有符合、数据文件、归档的重做日志文件,反之不完全恢复失败。
2、启动到mount状态
3、

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

Essential PHP programs: Install these to run smoothly! PHP is a popular server-side scripting language that is widely used to develop web applications. To successfully run a PHP program, you first need to install some necessary software and tools on the server. In this article, we will introduce the software and tools that must be installed, along with specific code examples to help you run PHP programs smoothly. 1. PHP interpreter The core of the PHP program is the PHP interpreter, which is responsible for parsing and executing PHP code. To install the PHP interpreter, you can follow

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

Widgets are a new feature of the Win11 system. They are turned on by default. However, it is inevitable that some users do not use widgets very much and want to disable them because they take up space. So how should they do this? The editor below will teach you how to operate it, and you can try it out. What are widgets? Widgets are small cards that display dynamic content from your favorite apps and services on your Windows desktop. They appear on the widget board, where you can discover, pin, unpin, arrange, resize, and customize widgets to reflect your interests. The widget board is optimized to display relevant widgets and personalized content based on usage. Open the widget panel from the left corner of the taskbar, where you can see live weather
