首先感谢群友分享的文档,在这里先感谢哆啦B梦,非常感谢

该文档主要指导如何利用现有的RAC环境搭建一套RAC与单实例的DG的环境


 ============================主机配置信息====================================
|   角色    |   主机名    |     管理IP     |      VIP       |    SCAN-IP     |
| RAC NODE1 | ktabsdb001r | 192.111.12.101 | 192.111.12.103 | 192.111.12.105 |
| RAC NODE2 | ktabsdb002r | 192.111.12.102 | 192.111.12.104 | 192.111.12.105 |
| Single DG | ktabsdb003r | 192.111.12.106 |      无        |       无       |
 ============================================================================


 ===========================数据库配置信息======================================
|   角色    |DB UNIQUE NAME| 数据库版本 |  归档路径  |       数据文件路径       |
|    RAC    |     abs      | 11.2.0.4.8 | /u01/arch/ |          +DATA           |
| DataGuard |    absdg     | 11.2.0.4.8 | /u01/arch/ | /u01/app/oracle/oradata/ |
 ===============================================================================


相关文档信息:
RAC Database Service With Physical Standby Role Option In 11gR2 - New Feature (文档 ID 1129143.1)




具体操作如下:
1.更改源RAC数据库为归档模式,并启用force_logging
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /u01/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence     11
Current log sequence           12


SQL> alter system set log_archive_dest_1='location=/u01/arch' sid='*';      


System altered.


ktabsdb001r:/home/oracle$srvctl stop database -d abs


ktabsdb001r:/home/oracle$export ORACLE_SID=abs1
ktabsdb001r:/home/oracle$sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 29 02:57:04 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup mount;
ORACLE instance started.


Total System Global Area 2572144640 bytes
Fixed Size                  2249120 bytes
Variable Size             704646752 bytes
Database Buffers         1845493760 bytes
Redo Buffers               19755008 bytes
Database mounted.


SQL> alter database archivelog;


Database altered.


SQL> alter database force logging;


Database altered.


SQL> alter database open;


Database altered.


ktabsdb001r:/home/oracle$srvctl start instance -i abs2 -d abs


ktabsdb001r:/home/oracle$sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 29 02:59:26 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application absing options


SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/arch
Oldest online log sequence     11
Next log sequence to archive   12
Current log sequence           12


SQL> select open_mode from gv$database;


OPEN_MODE
--------------------
READ WRITE
READ WRITE


SQL> alter system archive log current;


System altered.


2.修改主库的参数文件
SQL> create pfile='/home/oracle/pfile.ora' from spfile;


File created.


SQL> exit


修改主库参数文件
##DataGuard Configuration
alter system set LOG_ARCHIVE_CONFIG = 'DG_CONFIG=(abs,absdg)' scope=spfile sid='*';
alter system set LOG_ARCHIVE_DEST_1 = 'LOCATION=/u01/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=abs' scope=spfile sid='*';
alter system set LOG_ARCHIVE_DEST_2 = 'SERVICE=absdg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=absdg' scope=spfile sid='*';
alter system set FAL_SERVER = 'absdg' scope=spfile sid='*'; 
alter system set FAL_CLIENT = 'abs' scope=spfile sid='*';
alter system set STANDBY_FILE_MANAGEMENT='AUTO' scope=spfile sid='*';
alter system set DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/absdg/','+DATA/abs/datafile/','/u01/app/oracle/oradata/absdg/','+DATA/abs/tempfile/' scope=spfile sid='*';
alter system set LOG_FILE_NAME_CONVERT='/u01/app/oracle/oradata/absdg/','+DATA/abs/onlinelog/' scope=spfile sid='*';


重启数据库
kttestdb001r:/home/oracle$srvctl stop database -d abs
kttestdb001r:/home/oracle$srvctl start database -d abs
3.修改主库的tnsnames.ora(所有节点)
ABS =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.111.12.105)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = abs)
    )
  )
  
absdg =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.111.12.106)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = absdg)
    )
  )


4.修改备库的tnsnames.ora和listener.ora
tnsnames.ora内容如下
#192.111.12.105为SCAN-IP
absdg =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.111.12.106)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = absdg)
    )
  )


ABS =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.111.12.105)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = abs)
    )
  )
  
listener.ora内容如下
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = kttestdb003r)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )


ADR_BASE_LISTENER = /u01/app/oracle


SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =
      (SID_NAME = absdg)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (GLOBAL_DBNAME = absdg)
     )
    )


5.拷备主库的密码文件,创建备库参数文件
kttestdb001r:/u01/app/oracle/product/11.2.0/db_1/dbs$scp orapwabs1 192.111.12.106:/u01/app/oracle/product/11.2.0/db_1/dbs/orapwabsdg
备库创建相关目录
kttestdb003r:/u01/app/oracle$mkdir -p /u01/app/oracle/admin/absdg/adump
修改后的备库参数文件如下:
*.audit_file_dest='/u01/app/oracle/admin/absdg/adump'#modified
*.audit_trail='NONE'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/absdg/control01.ctl'#modified
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata/absdg/'#modified
*.db_domain=''
*.db_file_name_convert='+DATA/abs/datafile/','/u01/app/oracle/oradata/absdg/','+DATA/abs/tempfile/','/u01/app/oracle/oradata/absdg/'#modified
*.db_name='abs'
*.db_unique_name='absdg'#modified
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=absdgXDB)'#modified
*.fal_client='absdg'#modified
*.fal_server='abs'#modified
*.log_archive_config='DG_CONFIG=(abs,absdg)'
*.log_archive_dest_1='LOCATION=/u01/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=absdg'#modified
*.log_archive_dest_2='SERVICE=abs LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=abs'#modified
*.log_file_name_convert='+DATA/abs/onlinelog/','/u01/app/oracle/oradata/absdg/'#modified
*.open_cursors=300
*.pga_aggregate_target=858783744
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=2576351232
*.standby_file_management='AUTO'#modified
*.undo_tablespace='UNDOTBS1'#modified


6.启动备库
kttestdb003r:/home/oracle$export ORACLE_SID=absdg
kttestdb003r:/home/oracle$sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 29 17:26:22 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup nomount pfile='?/dbs/initabsdg.ora';
ORACLE instance started.


Total System Global Area 2572144640 bytes
Fixed Size                  2249120 bytes
Variable Size             654315104 bytes
Database Buffers         1895825408 bytes
Redo Buffers               19755008 bytes


7.双方互测监听是否正常
主库测备库监听
kttestdb001r:/home/oracle$sqlplus sys/oracle@absdg as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 29 04:27:01 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> exit


备库测主备监听
kttestdb003r:/home/oracle$sqlplus sys/oracle@abs as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 29 17:27:19 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.




Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


SQL> exit


8.将主库duplicate至备库
kttestdb001r:/home/oracle$rman target / auxiliary sys/oracle@absdg nocatalog


Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jun 29 05:02:49 2016


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: ABS (DBID=1253241113)
using target database control file instead of recovery catalog
connected to auxiliary database: ABS (not mounted)


RMAN> duplicate target database for standby from active database ;


----------------------日志输出如下-------------------------------
Starting Duplicate Db at 2016-06-29 05:03:07
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=66 device type=DISK


contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwabs1' auxiliary format 
 '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwabsdg'   ;
}
executing Memory Script


Starting backup at 2016-06-29 05:03:08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=196 instance=abs1 device type=DISK
Finished backup at 2016-06-29 05:03:09


contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/u01/app/oracle/oradata/absdg/control01.ctl';
}
executing Memory Script


Starting backup at 2016-06-29 05:03:09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_abs1.f tag=TAG20160629T050309 RECID=5 STAMP=915771791
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2016-06-29 05:03:11


contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script


sql statement: alter database mount standby database


contents of Memory Script:
{
   set newname for tempfile  1 to 
 "/u01/app/oracle/oradata/absdg/temp.263.915749599";
   switch clone tempfile all;
   set newname for datafile  1 to 
 "/u01/app/oracle/oradata/absdg/system.256.915749509";
   set newname for datafile  2 to 
 "/u01/app/oracle/oradata/absdg/sysaux.257.915749509";
   set newname for datafile  3 to 
 "/u01/app/oracle/oradata/absdg/undotbs1.258.915749509";
   set newname for datafile  4 to 
 "/u01/app/oracle/oradata/absdg/users.259.915749509";
   set newname for datafile  5 to 
 "/u01/app/oracle/oradata/absdg/undotbs2.264.915749683";
   backup as copy reuse
   datafile  1 auxiliary format 
 "/u01/app/oracle/oradata/absdg/system.256.915749509"   datafile 
 2 auxiliary format 
 "/u01/app/oracle/oradata/absdg/sysaux.257.915749509"   datafile 
 3 auxiliary format 
 "/u01/app/oracle/oradata/absdg/undotbs1.258.915749509"   datafile 
 4 auxiliary format 
 "/u01/app/oracle/oradata/absdg/users.259.915749509"   datafile 
 5 auxiliary format 
 "/u01/app/oracle/oradata/absdg/undotbs2.264.915749683"   ;
   sql 'alter system archive log current';
}
executing Memory Script


executing command: SET NEWNAME


renamed tempfile 1 to /u01/app/oracle/oradata/absdg/temp.263.915749599 in control file


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


executing command: SET NEWNAME


Starting backup at 2016-06-29 05:03:16
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/abs/datafile/system.256.915749509
output file name=/u01/app/oracle/oradata/absdg/system.256.915749509 tag=TAG20160629T050317
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/abs/datafile/sysaux.257.915749509
output file name=/u01/app/oracle/oradata/absdg/sysaux.257.915749509 tag=TAG20160629T050317
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/abs/datafile/undotbs1.258.915749509
output file name=/u01/app/oracle/oradata/absdg/undotbs1.258.915749509 tag=TAG20160629T050317
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/abs/datafile/users.259.915749509
output file name=/u01/app/oracle/oradata/absdg/users.259.915749509 tag=TAG20160629T050317
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/abs/datafile/undotbs2.264.915749683
output file name=/u01/app/oracle/oradata/absdg/undotbs2.264.915749683 tag=TAG20160629T050317
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
Finished backup at 2016-06-29 05:05:43


sql statement: alter system archive log current


contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script


datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=915818779 file name=/u01/app/oracle/oradata/absdg/system.256.915749509
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=915818779 file name=/u01/app/oracle/oradata/absdg/sysaux.257.915749509
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=915818779 file name=/u01/app/oracle/oradata/absdg/undotbs1.258.915749509
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=915818779 file name=/u01/app/oracle/oradata/absdg/users.259.915749509
datafile 5 switched to datafile copy
input datafile copy RECID=9 STAMP=915818779 file name=/u01/app/oracle/oradata/absdg/undotbs2.264.915749683
Finished Duplicate Db at 2016-06-29 05:06:02


----------------------日志输出完毕----------------------




9.主库和备库分别添加standby logfile
standby logfile建议比redo logfile多1至2组
主库:
SQL> alter database add standby logfile thread 1 group 7 '+DATA' size 500M,group 8 '+DATA' size 500M,group 9 '+DATA' size 500M,group 13 '+DATA' size 500M;


Database altered.


SQL> alter database add standby logfile thread 2 group 10 '+DATA' size 500M,group 11 '+DATA' size 500M,group 12 '+DATA' size 500M,group 14 '+DATA' size 500M;


Database altered.


SQL>  select group#,thread#,bytes/1024/1024 from v$standby_log;


    GROUP#    THREAD# BYTES/1024/1024
---------- ---------- ---------------
         7          1             500
         8          1             500
         9          1             500
        10          2             500
        11          2             500
        12          2             500
        13          1             500
        14          2             500


8 rows selected.


备库:
SQL> alter database add standby logfile thread 1 group 7 '/u01/app/oracle/oradata/absdg/redo_standby01' size 500M,group 8 '/u01/app/oracle/oradata/absdg/redo_standby02' size 500M,group 9 '/u01/app/oracle/oradata/absdg/redo_standby03' size 500M,group 10 '/u01/app/oracle/oradata/absdg/redo_standby04' size 500M;


Database altered.


SQL> select group#,thread#,bytes/1024/1024 from v$standby_log;


    GROUP#    THREAD# BYTES/1024/1024
---------- ---------- ---------------
         7          1             500
         8          1             500
         9          1             500
        10          1             500
10.备库清除多余的redo日志组(此步不做不受影响)
#因为主库为RAC,备库为单机,所以备库里面有多余的redo日志需要清理。该动作需要备库处于open read write状态才可以操作(即切到primary状态)
SQL> select open_mode, database_role, switchover_status from v$database;


OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- ---------------- --------------------
READ WRITE           PRIMARY          SESSIONS ACTIVE


SQL> select THREAD#,INSTANCE,STATUS, ENABLED from v$thread;


   THREAD# INSTANCE                                                                         STATUS          ENABLED
---------- -------------------------------------------------------------------------------- --------------- --------
         1 absdg                                                                            OPEN            PUBLIC
         2 abs2                                                                             CLOSED          PUBLIC


SQL> alter database disable thread 2;


Database altered.


SQL> select group# from v$log where THREAD#=2;


    GROUP#
----------
         3
         4
         6


SQL> alter database drop logfile group 3;


Database altered.


SQL> alter database drop logfile group 4;


Database altered.


SQL> alter database drop logfile group 6;


Database altered.








10.测试备库的DG是否可用


SQL> alter database open;


Database altered.


SQL> select open_mode from v$database;


OPEN_MODE
--------------------
READ ONLY


SQL> alter database recover managed standby database using current logfile disconnect from session;




11.DG角色切换测试
关闭RAC的实例2
srvctl stop instance -i abs2 -d abs


查看主库实例1的状态
SQL> select switchover_status from v$database;


SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE


执行主库的SWITCHOVER切换操作
SQL> alter database commit to switchover to physical standby with session shutdown;


Database altered.


重新启动主库
SQL> startup mount
ORACLE instance started.


Total System Global Area 2572144640 bytes
Fixed Size                  2249120 bytes
Variable Size             704646752 bytes
Database Buffers         1845493760 bytes
Redo Buffers               19755008 bytes
Database mounted.


SQL> alter database open;


Database altered.


SQL> select switchover_status from v$database;


SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE


查看备库的状态
SQL> select open_mode, database_role, switchover_status from v$database;


OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- ---------------- --------------------
READ ONLY            PHYSICAL STANDBY TO PRIMARY


备库切换至primary的状态
SQL> alter database commit to switchover to primary;


Database altered.


SQL> select open_mode from v$database;


OPEN_MODE
--------------------
MOUNTED


SQL> alter database open;


Database altered.


SQL> select open_mode from v$database;


OPEN_MODE
--------------------
READ WRITE


启动主库实例2
kttestdb002r:/home/oracle$sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 29 07:06:31 2016


Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup
ORACLE instance started.


Total System Global Area 2572144640 bytes
Fixed Size                  2249120 bytes
Variable Size             704646752 bytes
Database Buffers         1845493760 bytes
Redo Buffers               19755008 bytes
Database mounted.
Database opened.


SQL> select open_mode, database_role, switchover_status from v$database;


OPEN_MODE            DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- ---------------- --------------------
READ ONLY WITH APPLY PHYSICAL STANDBY NOT ALLOWED


再次感谢

【ORACLE】11g rac+dg的更多相关文章

  1. 【Oracle】11g direct path read介绍:10949 event、_small_table_threshold与_serial_direct_read

    转自刘相兵老师的博文: http://www.askmaclean.com/archives/11g-direct-path-read-10949-_small_table_threshold-_se ...

  2. 【Oracle】11G 11.2.0.4 RAC环境打补丁

    一.准备工作 1,数据库环境 操作系统版本  : RedHat 7.2 x64   数据库版本    : Oracle 11.2.0.4 x64 RAC    Grid          : 11.2 ...

  3. 【ORACLE】oracle11g RAC搭建

    --安装好操作系统(rhel-server-6.7 on vmware) 注意事项: 1.磁盘配置lvm 2.账号密码 root/oracle ---------------------------- ...

  4. 【Oracle】10g rac如何开启归档和关闭归档

    开启归档: 1.设置想设置的归档的位置,我们这里归档的位置为ASM磁盘组,磁盘组的名称为DATA alter system set log_archive_dest_1='location=+DATA ...

  5. 【oracle】11g服务器安装详细步骤

    以下是百度经验:https://jingyan.baidu.com/article/363872eccfb9266e4aa16f5d.html 1.同时解压 2.setup 3.

  6. 【Oracle】CentOS7/CentOS8命令行重启Oracle 11G R2

    写在前面 按照读者朋友的要求写了一篇<[Oracle]CentOS7/CentOS8命令行安装Oracle 11G R2>,由于读者完全是按照我的安装方式安装的Oracle数据库,也是将O ...

  7. 转【Oracle】一款非常好用的trace文件分析工具

    [Oracle]一款非常好用的trace文件分析工具之一   北在南方 2016-04-14 11:23:58 浏览547 评论0 摘要: 介绍一款非常好用的10046分析工具--trca(Trace ...

  8. 【ORACLE】调整序列的当前种子值

    [ORACLE]调整序列的当前种子值 --必须用SYS用户执行脚本:或具有SYSDBA角色登录: CREATE OR replace ); v_step ):;--步进 tsql ); BEGIN E ...

  9. [转帖]【Oracle】详解Oracle中NLS_LANG变量的使用

    [Oracle]详解Oracle中NLS_LANG变量的使用 https://www.cnblogs.com/HDK2016/p/6880560.html NLS_LANG=LANGUAGE_TERR ...

随机推荐

  1. Eureka系列(三)获取服务Client端具体实现

    获取服务Client 端流程   我们先看下面这张图片,这张图片简单描述了下我们Client是如何获取到Server已续约实例信息的流程:  从图片中我们可以知晓大致流程就是Client会自己开启一个 ...

  2. kepler.gl 2.4.0重要更新

    1 简介 kepler.gl作为开源地理空间数据可视化神器,也一直处于活跃的迭代开发状态下.而在前不久,kepler.gl正式发布了其2.4.0版本,下面我们就来对其重要的新特性进行介绍: 图1 2 ...

  3. Python简单的验证码生成

    用python生成简单的四位数验证码: 1 import random 2 3 if __name__ == "__main__": #这句话简单的理解就是,只有在本文件下以下的代 ...

  4. c# 递归 yield关键字的用法

    1.yield实现的功能 yield return: 先看下面的代码,通过yield return实现了类似用foreach遍历数组的功能,说明yield return也是用来实现迭代器的功能的. u ...

  5. Autofac的基本使用---目录

    目录 Autofac的基本使用---1.前言 Autofac的基本使用---2.普通类型 Autofac的基本使用---3.泛型类型 Autofac的基本使用---4.使用Config配置 Autof ...

  6. [论文分享] DHP: Differentiable Meta Pruning via HyperNetworks

    [论文分享] DHP: Differentiable Meta Pruning via HyperNetworks authors: Yawei Li1, Shuhang Gu, etc. comme ...

  7. Linux嵌入式学习-USB端口号绑定

    由于ubuntu USB设备号为从零开始依次累加,所以多个设备每次开机后设备号不固定,机器人每次开机都要蛋疼的按顺序插, 在网上找到一种方法:udev的规则 udev的规则说明,可以参考博客说明:ht ...

  8. Qt学习笔记-更高级的文本编辑器-完善第一版-gif动画

    现在的浏览器大多都有动作图标,现在我们也为浏览器加上图标. 在网上搜索到了几个ico的图标.现在直接拿来用. 首先创建资源文件. 在工程名上鼠标右键,选择add new 然后再选择 Qt Resour ...

  9. Hadoop之WordCount

    求平均数是MapReduce比较常见的算法,求平均数的算法也比较简单,一种思路是Map端读取数据,在数据输入到Reduce之前先经过shuffle,将map函数输出的key值相同的所有的value值形 ...

  10. JAVA Executor(线程池)框架

    一.Executor概述 为更好控制线程,jdk提供一套线程管理框架Executor,帮助开发人员有效地进行线程控制.它们都位于java.util.concurrent包中,是jdk并发包的核心.其中 ...