使用rman备份将rac环境恢复到单实例
使用rman备份将rac环境恢复到单实例
rac环境
[oracle@rac02 ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.11.*.61 rac01
1.1.1.13 rac01-priv
10.11.*.200 rac01-vip
10.11.*.62 rac02
1.1.1.14 rac02-priv
10.11.*.201 rac02-vip
10.11.*.202 scanvip-ip
rac集群信息查看
# crsstat
ora.bol.db ora....se.type 0/2 0/1 ONLINE ONLINE rac01
[oracle@rac02 ~]$ sqlplus / as sysdba
SQL> show parameter cluster NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
SQL> show parameter name NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string bol
db_unique_name string bol
global_names boolean FALSE
instance_name string bol2
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string bol
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA/bol/arch
Oldest online log sequence 343
Next log sequence to archive 344
Current log sequence 344
SQL> set line 9999 pagesize 9999
SQL> col FILE_NAME format a60
SQL> select 'datafile' file_type, file#,name FILE_NAME,status,enabled from v$datafile
union all
select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
union all
select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
union all
select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile
;
FILE_TYPE FILE# FILE_NAME STATUS ENABLED
----------- ---------- ------------------------------------------------------------ ------- ----------
datafile 1 +DATA/bol/datafile/system.259.1015241807 SYSTEM READ WRITE
datafile 2 +DATA/bol/datafile/sysaux.260.1015241811 ONLINE READ WRITE
datafile 3 +DATA/bol/datafile/undotbs1.261.1015241811 ONLINE READ WRITE
datafile 4 +DATA/bol/datafile/undotbs2.263.1015241815 ONLINE READ WRITE
datafile 5 +DATA/bol/datafile/users.264.1015241815 ONLINE READ WRITE
datafile 6 +DATA/bol/datafile/cad01.dbf ONLINE READ WRITE
datafile 7 +DATA/bol/datafile/scm01.dbf ONLINE READ WRITE
datafile 8 +DATA/bol/datafile/zabbix01.dbf ONLINE READ WRITE
tempfile 1 +DATA/bol/tempfile/temp.262.1015241813 ONLINE READ WRITE
logfile 1 +DATA/bol/onlinelog/group_1.257.1015241807
logfile 1 +FRA/bol/onlinelog/group_1.257.1015241807
logfile 2 +DATA/bol/onlinelog/group_2.258.1015241807
logfile 2 +FRA/bol/onlinelog/group_2.258.1015241807
logfile 3 +DATA/bol/onlinelog/group_3.265.1015242985
logfile 3 +FRA/bol/onlinelog/group_3.259.1015242985
logfile 4 +DATA/bol/onlinelog/group_4.266.1015242985
logfile 4 +FRA/bol/onlinelog/group_4.260.1015242985
controlfile +DATA/bol/controlfile/current.256.1015241807
controlfile +FRA/bol/controlfile/current.256.1015241807
SQL> show parameter instance_n NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_name string bol2
instance_number integer 2
SQL> show parameter spfile NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/bol/spfilebol.ora
查看rac02节点的rman备份
#ll -art /home/oracle/backup
-rw-r----- 1 oracle asmadmin 85729280 Dec 3 22:35 bol_fullbakepuihggn_1_1_20191203
-rw-r----- 1 oracle asmadmin 2966593536 Dec 3 22:35 bol_fullbakequihggo_1_1_20191203
-rw-r----- 1 oracle asmadmin 144319488 Dec 3 22:35 arch_esuihghs_1_1_20191203
-rw-r----- 1 oracle asmadmin 72366080 Dec 3 22:35 arch_etuihght_1_1_20191203
-rw-r----- 1 oracle asmadmin 18644992 Dec 3 22:35 20191203_BOL_478_1_4237955019.ctl
-rw-r----- 1 oracle asmadmin 98304 Dec 3 22:35 bol_spfile_evuihgi1_1_1_20191203
将rman备份文件cp到单实例环境(这里的单实例环境-只安装了数据库软件)
[oracle@rac02 backup]$ scp bol_fullbakepuihggn_1_1_20191203 bol_fullbakequihggo_1_1_20191203 arch_esuihghs_1_1_20191203 arch_etuihght_1_1_20191203 20191203_BOL_478_1_4237955019.ctl bol_spfile_evuihgi1_1_1_20191203 oracle@10.11.*.80:/home/oracle/backup/.
[oracle@oracle backup]$ cp bol_spfile_evuihgi1_1_1_20191203 initbol.ora
---修改参数文件
[oracle@oracle backup]$ more initbol.ora
*.audit_file_dest='/u01/app/oracle/admin/bol/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/bol/control01.ctl','/u01/app/oracle/fast_recovery_area/bol/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='bol'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=6005194752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=bolXDB)'
*.log_archive_dest_1='location=/u01/app/oracle/archive'
*.log_archive_format='%t_%s_%r.arch'
*.memory_target=2147483648
*.open_cursors=300
*.processes=350
*.remote_login_passwordfile='exclusive'
*.standby_file_management='auto'
*.undo_tablespace='UNDOTBS1'
---select 6744440832/1024/1024/1024,3*1024*1024*1024;
单实例库创建目录
mkdir -p /u01/app/oracle/fast_recovery_area/bol
mkdir -p /u01/app/oracle/oradata/bol/data
mkdir -p /u01/app/oracle/oradata/bol/tempfile
mkdir -p /u01/app/oracle/admin/bol/adump
mkdir -p /u01/app/oracle/admin/bol/data
mkdir -p /u01/app/oracle/admin/bol/redo
mkdir -p /u01/app/oracle/admin/bol/tempfile
mkdir -p /u01/app/oracle/archive
单实例创建spfile文件
[oracle@oracle ~]$ vim .bash_profile
[oracle@oracle ~]$ source .bash_profile
[oracle@oracle ~]$ sqlplus -v SQL*Plus: Release 11.2.0.4.0 Production
[oracle@oracle dbs]$ ORACLE_SID=bol
[oracle@oracle dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Dec 4 11:30:49 2019 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> create spfile from pfile='/home/oracle/backup/initbol.ora'; File created.
启动单实例到nomount状态
[oracle@oracle ~]$ rman target / Recovery Manager: Release 11.2.0.4.0 - Production on Wed Dec 4 11:35:07 2019 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database (not started) RMAN> startup nomount; Oracle instance started Total System Global Area 2137886720 bytes Fixed Size 2254952 bytes
Variable Size 1342179224 bytes
Database Buffers 788529152 bytes
Redo Buffers 4923392 bytes
从备份中恢复控制文件
==restore controlfile from '/home/oracle/backup/20191203_BOL_478_1_4237955019.ctl';
RMAN> restore controlfile from '/home/oracle/backup/20191203_BOL_478_1_4237955019.ctl'; Starting restore at 04-DEC-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=284 device type=DISK channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/bol/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/bol/control02.ctl
Finished restore at 04-DEC-19
==控制文件已经还原,注意此处控制文件的还原路径是spfile中指定的路径,接下来还原数据文件及恢复数据库
==启动到mount状态并还原和恢复整个数据库
RMAN> alter database mount; database mounted
released channel: ORA_DISK_1 RMAN> list backupset summary;
RMAN> list backupset of archivelog all;
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
477 69.01M DISK 00:00:01 03-DEC-19
BP Key: 477 Status: AVAILABLE Compressed: NO Tag: TAG20191203T223540
Piece Name: /home/oracle/backup/arch_etuihght_1_1_20191203 List of Archived Logs in backup set 477
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 433 10580072 03-DEC-19 10598676 04-DEC-19
1 434 10598676 04-DEC-19 10598684 04-DEC-19
2 341 10594034 04-DEC-19 10597753 04-DEC-19
2 342 10597753 04-DEC-19 10598672 04-DEC-19
2 343 10598672 04-DEC-19 10598689 04-DEC-19
==数据文件的转换
SQL> set pagesize 200 linesize 200
SQL> select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'
from v$datafile a
union all
select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";'
from v$tempfile a
union all
SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || ''''' to ''''' ||
a.MEMBER || ''''' ";'
FROM v$logfile a;
'SETNEWNAMEFORDATAFILE'||A.FILE#||'TO"'||A.NAME||'";'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set newname for datafile 1 to "+DATA/bol/datafile/system.259.1015241807";
set newname for datafile 2 to "+DATA/bol/datafile/sysaux.260.1015241811";
set newname for datafile 3 to "+DATA/bol/datafile/undotbs1.261.1015241811";
set newname for datafile 4 to "+DATA/bol/datafile/undotbs2.263.1015241815";
set newname for datafile 5 to "+DATA/bol/datafile/users.264.1015241815";
set newname for datafile 6 to "+DATA/bol/datafile/cad01.dbf";
set newname for datafile 7 to "+DATA/bol/datafile/scm01.dbf";
set newname for datafile 8 to "+DATA/bol/datafile/zabbix01.dbf";
set newname for tempfile 1 to "+DATA/bol/tempfile/temp.262.1015241813";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_1.257.1015241807'' to ''+DATA/bol/onlinelog/group_1.257.1015241807'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_1.257.1015241807'' to ''+FRA/bol/onlinelog/group_1.257.1015241807'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_2.258.1015241807'' to ''+DATA/bol/onlinelog/group_2.258.1015241807'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_2.258.1015241807'' to ''+FRA/bol/onlinelog/group_2.258.1015241807'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_3.265.1015242985'' to ''+DATA/bol/onlinelog/group_3.265.1015242985'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_3.259.1015242985'' to ''+FRA/bol/onlinelog/group_3.259.1015242985'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_4.266.1015242985'' to ''+DATA/bol/onlinelog/group_4.266.1015242985'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_4.260.1015242985'' to ''+FRA/bol/onlinelog/group_4.260.1015242985'' "; 17 rows selected. RMAN> RUN{
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
set newname for datafile 1 to "/u01/app/oracle/oradata/bol/data/system01.dbf";
set newname for datafile 2 to "/u01/app/oracle/oradata/bol/data/sysaux02.dbf";
set newname for datafile 3 to "/u01/app/oracle/oradata/bol/data/undotbs101.dbf";
set newname for datafile 4 to "/u01/app/oracle/oradata/bol/data/undotbs202.dbf";
set newname for datafile 5 to "/u01/app/oracle/oradata/bol/data/users01.dbf";
set newname for datafile 6 to "/u01/app/oracle/oradata/bol/data/cad01.dbf";
set newname for datafile 7 to "/u01/app/oracle/oradata/bol/data/scm01.dbf";
set newname for datafile 8 to "/u01/app/oracle/oradata/bol/data/zabbix01.dbf";
set newname for tempfile 1 to "/u01/app/oracle/oradata/bol/tempfile/temp01.dbf";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_1.257.1015241807'' to ''/u01/app/oracle/admin/bol/redo/redo01_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_1.257.1015241807'' to ''/u01/app/oracle/admin/bol/redo/redo01_2.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_2.258.1015241807'' to ''/u01/app/oracle/admin/bol/redo/redo02_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_2.258.1015241807'' to ''/u01/app/oracle/admin/bol/redo/redo02_2.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_3.265.1015242985'' to ''/u01/app/oracle/admin/bol/redo/redo03_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_3.259.1015242985'' to ''/u01/app/oracle/admin/bol/redo/redo03_2.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+DATA/bol/onlinelog/group_4.266.1015242985'' to ''/u01/app/oracle/admin/bol/redo/redo04_1.log'' ";
SQL "ALTER DATABASE RENAME FILE ''+FRA/bol/onlinelog/group_4.260.1015242985'' to ''/u01/app/oracle/admin/bol/redo/redo04_2.log'' ";
RESTORE DATABASE;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
}
==告警日志
==查看数据文件是否已经还原
[oracle@oracle ~]$ ll -h /u01/app/oracle/oradata/bol/data/
total 6.9G
-rw-r-----. 1 oracle oinstall 1.1G Dec 4 11:58 cad01.dbf
-rw-r-----. 1 oracle oinstall 1.1G Dec 4 11:58 scm01.dbf
-rw-r-----. 1 oracle oinstall 2.4G Dec 4 11:59 sysaux02.dbf
-rw-r-----. 1 oracle oinstall 761M Dec 4 11:59 system01.dbf
-rw-r-----. 1 oracle oinstall 1.2G Dec 4 11:58 undotbs101.dbf
-rw-r-----. 1 oracle oinstall 201M Dec 4 11:58 undotbs202.dbf
-rw-r-----. 1 oracle oinstall 5.1M Dec 4 11:58 users01.dbf
-rw-r-----. 1 oracle oinstall 501M Dec 4 11:58 zabbix01.dbf
==由前边的备份集中可以看出,备份集中的thread 1的最大日志号为434,thread 2的最大日志号为343,所以不完全恢复
RMAN> run{
2> set until sequence 434 thread 1;
3> set until sequence 343 thread 2;
4> recover database;
5> } executing command: SET until clause executing command: SET until clause Starting recover at 04-DEC-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=284 device type=DISK starting media recovery channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=433
channel ORA_DISK_1: restoring archived log
archived log thread=2 sequence=342
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/arch_etuihght_1_1_20191203
channel ORA_DISK_1: piece handle=/home/oracle/backup/arch_etuihght_1_1_20191203 tag=TAG20191203T223540
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/oracle/archive/2_342_1015241803.arch thread=2 sequence=342
archived log file name=/u01/app/oracle/archive/1_433_1015241803.arch thread=1 sequence=433
media recovery complete, elapsed time: 00:00:00
Finished recover at 04-DEC-19
使用resetlogs打开数据库
RMAN> alter database open resetlogs; database opened
查看redo日志
[oracle@oracle backup]$ ll -h /u01/app/oracle/admin/bol/redo/
total 401M
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo01_1.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo01_2.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo02_1.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo02_2.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo03_1.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo03_2.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo04_1.log
-rw-r-----. 1 oracle oinstall 51M Dec 4 12:18 redo04_2.log
查看相关文件
[oracle@oracle backup]$ sqlplus / as sysdba
SQL> show parameter name
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/archive
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> set line 9999 pagesize 9999
SQL> col FILE_NAME format a60
SQL> select 'datafile' file_type, file#,name FILE_NAME,status,enabled from v$datafile
union all
select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
union all
select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
union all
select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile
;
==清除未使用的redo
SQL> col instance format a8
SQL> select thread#,instance,status,enabled from v$thread; THREAD# INSTANCE STATUS ENABLED
---------- -------- ------ --------
1 bol OPEN PUBLIC
2 bol2 CLOSED PUBLIC SQL> select group#,thread#,archived,status from v$log; GROUP# THREAD# ARC STATUS
---------- ---------- --- ----------------
1 1 NO CURRENT
2 1 YES UNUSED
3 2 YES INACTIVE
4 2 YES UNUSED SQL> alter database disable thread 2; Database altered. SQL> select thread#,instance,status,enabled from v$thread; THREAD# INSTANCE STATUS ENABLED
---------- -------- ------ --------
1 bol OPEN PUBLIC
2 bol2 CLOSED DISABLED
==清除多余的 undo 文件
SQL> select name from v$tablespace where name like 'UNDO%'; NAME
------------------------------
UNDOTBS1
UNDOTBS2 SQL> show parameter undo_tablespace; NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace string UNDOTBS1
SQL> drop tablespace undotbs2 including contents and datafiles; Tablespace dropped.
到此,恢复以及完成。迁移还可以使用在线 RMAN Duplicate
参考:
https://www.cnblogs.com/lhrbest/p/4546661.html
使用rman备份将rac环境恢复到单实例的更多相关文章
- 【RAC】将RAC备份集恢复为单实例数据库
[RAC]将RAC备份集恢复为单实例数据库 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识, ...
- rman 备份并异机恢复
1.RMAN 备份脚本 RUN { CONFIGURE RETENTION POLICY DAYS; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CO ...
- rman备份与异机恢复
一.rman备份脚本并为定时任务 #!/bin/bashsource ~/.bash_profileexport LANG=en_USBACKUP_DATE=`date +%d`#RMAN_LOG_F ...
- RAC+asm通过rman恢复到单实例+asm
1.恢复参数文件,并修改参数文件 参数文件指名几个最简单的就行,我的参数文件如下: 2.恢复控制文件,并启动数据库到mount 如果是把备份集从别的服务器拷贝到本地恢复的服务器的目录,使用下面的语句指 ...
- UNIX环境高级编程——单实例的守护进程
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h&g ...
- Oracle 11g RAC 环境下单实例非缺省监听及端口配置
如果在Oracle 11g RAC环境下使用dbca创建单实例数据库后,Oracle会自动将其注册到缺省的1521端口及监听器.大多数情况下我们使用的为非缺省监听器以及非缺省的监听端口.而且在Orac ...
- Oracle RAC 实验环境RMAN备份v1.01
Oracle RAC 实验环境RMAN备份v1.01 环境:RHEL 6.5 + Oracle GI 11.2.0.4 + RAC 11.2.0.4 (2 nodes) 需求:制定RAMN备份策略 版 ...
- Oracle RAC备份异机单实例恢复演练
本文只节选了操作方案的部分章节: 3. 操作步骤 3.1. 异机单实例Oracle数据库软件安装 在异机上进行单实例Oracle数据库软件安装.该步骤过程不再本文中重复描述,如果对安装过程存在疑问 ...
- 【RAC】将单实例备份集恢复为rac数据库
[RAC]将单实例备份集恢复为rac数据库 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识, ...
随机推荐
- linux内核 概念
内核Kernel只是操作系统的一部分,操作系统本身在内核之上还包含命令行shell和其他种类的用户界面. 通常内核包含: 中断服务程序 进程管理和调度程序 内存管理程序 进程同步方法 IO和设备等 在 ...
- ios 打包 异常
1. 问题:Xcode9升级到Xcode10后运行App报错: 2. 原因分析: Xcode10中libstdc++.6.0.9和libstdc++被移除,Frameworks中libstdc++.6 ...
- Mac修改显示器使支持原生缩放
教程 直接搬运没有意义,直接放链接.地址:https://bbs.feng.com/read-htm-tid-11677019.html 若无法访问请使用网页截图备份.地址:https://img20 ...
- spring + junit 测试
spring + junit 测试 需要一个工具类 package com.meizu.fastdfsweb; import org.junit.runner.RunWith; import org. ...
- 设置Portainer管理Docker并且开启https(简单方法)
1. 序言 Portainer是一个十分好用的docker图形化管理界面,可以很方便的查看容器状态,错误log等等. 2. 安装 安装portainer是十分简单的,只需要执行docker pull ...
- JavaScript关系运算符
★关系运算符 通过关系运算符可以比较两个值之间的大小关系 如果关系成立它会返回true,如果关系不成立立即返回false ㈠大于号 (>) ⑴判断符号左侧的值是否大于右侧的值 ⑵如果关系成立 ...
- python测试网站访问速度
# -*- coding: utf-8 -*- # @Author : Felix Wang # @time : 2018/8/13 22:13 # pip3 install pycurl impor ...
- “美登杯”上海市高校大学生程序设计邀请赛 (华东理工大学) E 小花梨的数组 线段树
题意 分析 预处理出每个数的最小素因子,首先可以知道\(minprime(x*minprime(x))=minprime(x)\),我们用线段树维护区间最大值\(mx[p]\),注意这里的最大值并不是 ...
- 2019牛客暑期多校训练营(第一场)H 线性基+计算贡献
题意 给n个整数,求满足子集异或和为0的子集大小之和. 分析 将问题转化为求每个元素的贡献次数之和. 先对n个数求线性基,设线性基大小为r,即插入线性基的数字个数为r,可以分别计算线性基内数的贡献和线 ...
- TCP连接创建与终止
创建连接:三次握手一句话,”就是客户端发个syn,服务端发个syn+ack,客户端再回个ack“ 终止连接:四次挥手