041225

本文介绍了使用RMAN恢复数据库的多种方法,包括非归档模式和归档模式下的恢复、恢复文件到新位置、恢复表空间等。还阐述了三种不完全恢复类型,即基于时间、取消和更改的恢复,并给出了相应的操作步骤和示例。

使用RMAN恢复非归档模式的数据库
rman target /
RMAN> STARTUP MOUNT
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN RESETLOGS;

使用RMAN进行归档模式下的恢复
rman target /
RMAN> STARTUP MOUNT
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN;

使用RMAN恢复文件到新的位置
使用 SET NEWNAME 命令恢复文件到新的位置
SET NEWNAME FOR DATAFILE 1 to 
   ‘/<newdir>/system01.dbf’;

使用 SWITCH 命令记录更改在控制文件
SWITCH DATAFILE ALL;

Restoring Datafiles to a New Location
If you have experienced media failure such as the loss of a disk drive, you may need to
restore the datafiles to a new location.
Example
1. Connect to RMAN.
 rman target
2. Mount the database.
 RMAN> STARTUP MOUNT
3. Use RMAN to restore the datafile to the new location and record the change in the control file.
 run{
 set newname for datafile 1 to ?<newdir>/system01.dbf?...
 restore database;
 switch datafile all;
 recover database;
 alter database open; }

恢复表空间
Using RMAN to Recover a Tablespace
If you have determined that you need to restore and recover the users tablespace, issue the RMAN commands as follows:
 run{
 sql ‘alter tablespace users offline immediate’
 restore tablespace users;
 recover tablespace users;
 sql ‘alter tablespace users online’
 }

There are three types of incomplete recovery:
Time-based recovery
Cancel-based recovery
Change-based recovery

RECOVER Command Overview
1.Recover a database until cancel:
RECOVER DATABASE until cancel
2.Recover a database until time:
RECOVER DATABASE
until time '2002-07-24:14:22:03'
3.Recover using backup control file: 
RECOVER DATABASE
until time '2002-07-24:14:22:03'
using backup controlfile

使用using backup controlfile子句,那么一定要使用until语句


Incomplete Recovery Using UNTIL TIME
Shut down the database and begin recovery. Because the approximate time of the failure is known and the database structure has not changed since 11:44 a.m., you can use the UNTIL TIME method:
1. If the database is open, shut it down by using either the NORMAL, IMMEDIATE, or TRANSACTIONAL options.
2. Restore all datafiles from backup (the most recent if possible). You may need to restore archived logs. If there is enough space available, restore to the LOG_ARCHIVE_DEST location or use the ALTER SYSTEM ARCHIVE LOG START TO <LOCATION> or SET LOGSOURCE <LOCATION> to change the location.
3. Mount the database.

Incomplete Recovery Using UNTIL TIME (continued)
4. Recover the database:
 SQL> recover database until time '2002-03-09:11:44:00'
 ORA-00279: change 148448 …03/09/02 17:04:20 needed for thread ORA-00289: suggestion : /disk1/archive/arch_6 .rdo
 ORA-00280: change 148448 for thread 1 is in sequence #6 Log applied....
 Media recovery complete.
5. To synchronize datafiles with control files and redo logs, open the database by using
 the RESETLOGS option:
 SQL> alter database open resetlogs;
 SQL> archive log list
 ...
 Oldest online log sequence 0
 Next log sequence to archive 1
 Current log sequence 1
   6. Before performing the whole closed database backup, query the EMPLOYEES table to  make sure it exists.
When recovery is successful and the backup has completed, notify users that the database is
available for use, and any data entered after the recovery time (11:44 a.m.) will need to be
reentered.


Incomplete Recovery Using UNTIL CANCEL
You are concerned about block corruption in the EMPLOYEES table resulting from disk error. Because redo logs are contained on the same disk, you decide to check the status of redo logs and archived logs:
SQL> SELECT * FROM v$logfile;
GROUP#  STATUS            MEMBER                                                                         
------  ----------------  ---------------------------------
     2                    /disk1/data/log2a.rdo
   1                    /disk1/data/log1a.rdo
SQL> SELECT * FROM v$log;
G# ... SEQ#  BYTES  MEMBERS  ARC STATUS   ... FIRST_TIME
-- ... ----  ------ -------  --- -------- ... --------------
 1 ... 49    153600 1        NO  CURRENT  ... 02-03-09:11:55
 2 ... 48    153600 1        NO  INACTIVE ... 02-03-09:11:34

Incomplete Recovery Using UNTIL CANCEL (continued)
After searching through the /disk1/data directory, you notice that redo log log2a.rdo cannot be located and has not been archived. Therefore, you cannot recover past this point.
Querying V$LOG_HISTORY confirms the absence of archived log seq 48 (log2a.rdo):
SQL> SELECT * FROM v$log_history;
RECID STAMP  ...  FIRST_CHANGE FIRST_TIME
----- --------- ...  ------------ ----------
  1 318531466 ...  88330            02-02-28:12:43
 47 319512880 ...  309067           02-03-09:11:26
Because this is an OLTP system, the output from V$LOG shows that an extra 10 minutes of work will be lost if the database is recovered before applying log2a.rdo. Users are not happy about losing work, but can recover that work.
You can recover the database as follows:
1. Shut down the database.
2. Restore all datafiles from the most recent backup.
3. You already have a valid backup, so mount the database.

Incomplete Recovery Using UNTIL CANCEL (continued)
Recover the database until log seq 48:
 SQL> recover database until cancel
 ORA-00279:change 148448...03/02/02 12:45:20 needed for thread
 ORA-00289: suggestion : /disk1/archive/arch_34.rdo
 ORA-00280: change 148448 for thread 1 is in sequence #34
 Log applied.
 ...
 ORA-00279:change 309012...03/09/02 11:33:56 needed for thread
 ORA-00289: suggestion : /disk1/archive/arch_48.rdo
 ORA-00280: change 309012 for thread 1 is in sequence #48
 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
 cancel
 Media recovery cancelled.
Open the database by using the RESETLOGS option.
Check that the EMPLOYEES table exists.
When recovery is complete, make a backup. Notify users that the database is available for use, and any data entered after the recovery time (11:34 a.m.) will need to be reentered.

现在我要完成一个大项目我的毕业设计,我的题目是选题序号为6:基于Python的电影票房与评论情感分析系统,爬取两个不同来源的电影数据,必须是真实爬取,先给出项目框架搭建,再分别补充里面的代码。注意:数据量应达到5000条以上的有效结构化记录。给出项目框架搭建,以及很详细地给出相关代码,爬虫模块统一spider,后续方便给出代码也可以做出web网页来呈现我所做的分析系统。现在我要爬取猫眼热映和豆瓣TOP250分别100部电影,每部电影抓50条评论,总的数据就有10000条符合要求。要创建三张表,分别是movie,review,user,主机地址:localhost 或 127.0.0.1用户名:TQQ密码:TQq041225端口:3306(默认)。老师的要求: 技术要求: 数据源: ①多源采集:必须采集至少两个不同来源的数据(例如:两个招聘网站、两个电商平台)。 ②数据规模:数据量应达到5000条以上的有效结构化记录。 数据字段: ①字段数量:每条核心数据记录(如一个职位、一件商品、一条评论)应包含不少于8个有效字段。 ②字段类型:应覆盖标识类(ID、URL)、文本描述类(职位描述、评论内容)、数值类(薪资、价格、评分)、类别类(职位类别、商品分类)、时空类(发布时间、工作地点)等多种类型。 技术栈: ①使用Scrapy或Selenium框架实现爬虫,处理JavaScript渲染、验证码、IP封锁等反爬策略。 ②数据清洗需使用 Pandas 等进行系统化处理,包括处理缺失值、格式化不一致字段、去重、以及对不同来源的数据进行字段对齐与合并。 ③存储需使用MySQL或MongoDB: 关联表设计:必须设计至少三张逻辑关联的表,以体现数据库设计能力。 - 【示例:招聘系统】:公司表 (company)、职位表 (job)、技能表 (job_skill),其中职位表通过company_id关联公司表,技能表通过job_id关联职位表。 - 【示例:电商评论系统】:商品表 (product)、用户表 (user)、评论表 (review),其中评论表关联商品表和用户表。 设计合理性:表结构应遵循数据库设计范式,减少数据冗余。 总的来说就是爬取双源(猫眼热映+豆瓣TOP250)相关数据,再将爬取的数据导入数据库movie_analysis中的三个表(movie、review、user)中呈现出来,最后做出一个web网页展示我们所做得同给他们呈现出来。
11-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值