月归档:三月 2013

制作U盘刷EXADATA

在XD需要刷机(方言重装操作系统),现在比较常见的是一种是使用PXE来刷机,另外一张是使用U盘制作启动盘来刷机.PXE配置起来比较麻烦,这里展示制作U盘刷机的过程.db节点和cell节点的制作方法基本相同,这里以cell节点的U盘制作为例说明制作过程
1. 前提条件
1) Linux 64位机器(最好直接在db和cell节点的机器上直接处理
2) U盘大小最少4G
3) 上传preconf.csv配置文件(使用java配置)

2. 下载image文件
通过888828.1文档找到image的名称,然后在edelivery中下载

3. 查看U盘盘符

[root@xifenfei tmp]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3655    29358756   83  Linux
/dev/sda2            3656        3916     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 4048 MB, 4048551936 bytes
128 heads, 9 sectors/track, 6864 cylinders
Units = cylinders of 1152 * 512 = 589824 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           8        6864     3949096    b  W95 FAT32

4. 上传压缩文件到服务器,并解压

unzip V36290-01.zip
tar xvf cellImageMaker_11.2.3.2.1_LINUX.X64_130109-1.x86_64.tar 

5. dl180内容

[root@xifenfei tmp]# cd dl180/
[root@xifenfei dl180]# ll
total 92
drwxr-xr-x  3 root root  4096 Jan  9 22:33 boot
drwxrwxr-x  2 root root  4096 Jan  9 22:34 doc
drwxr-xr-x  2 root root  4096 Jan  9 22:33 grub
drwxr-xr-x 17 root root  4096 Jan  9 22:33 initrd
-rwxrwxr-x  1 root root 27485 Jan  9 22:34 makeImageMedia.sh
drwxrwxr-x  3 root root  4096 Jan  9 22:34 patches
-r-xr-xr-x  1 root root 39041 Mar 31  2011 README_FOR_FACTORY.txt
drwxrwxr-x  4 root root  4096 Jan  9 22:34 tmp

6. 制作U盘启动

--执行makeImageMedia.sh命令
[root@xifenfei dl180]# ./makeImageMedia.sh -preconf  /tmp/preconf.csv 
Done. Pre config verification OK
Please wait. Calculating md5 checksums for cellbits ...
Calculating md5 checksum for exaos.tbz ...
Calculating md5 checksum for cellboot.tbz ...
Calculating md5 checksum for cellfw.tbz ...
Calculating md5 checksum for kernel.tbz ...
Calculating md5 checksum for ofed.tbz ...
Calculating md5 checksum for sunutils.tbz ...
Calculating md5 checksum for hputils.tbz ...
Calculating md5 checksum for c7rpms.tbz ...
Calculating md5 checksum for commonos.tbz ...
Calculating md5 checksum for debugos.tbz ...
Calculating md5 checksum for cellrpms.tbz ...
Calculating md5 checksum for doclib.zip ...
Calculating md5 checksum for cell.bin ...
Please wait. Making initrd ...
214842 blocks
Please wait. Calculating md5 checksums for boot ...

Choose listed USB devices to set up the Oracle CELL installer

sdb   Approximate capacity 3953 MB 
--指定U盘盘符
Enter the comma separated (no spaces) list of devices or word 'ALL' for to select all: sdb <--注意
sdb will be used as the Oracle CELL installer

All data on sdb will be erased. Proceed [y/n]? y <--注意

The number of cylinders for this disk is set to 6864.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 6864.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): Command action
   e   extended
   p   primary partition (1-4)
Partition number (1-4): First cylinder (1-6864, default 1): Last cylinder or +size or +sizeM or +sizeK (1-6864, default 6864): 
Command (m for help): The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
umount2: Invalid argument
umount: /dev/sdb1: not mounted
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
495008 inodes, 988270 blocks
49413 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1015021568
31 block groups
32768 blocks per group, 32768 fragments per group
15968 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Copying files... will take several minutes


    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"... failed (this is not fatal)
 Running "embed /grub/e2fs_stage1_5 (hd0,0)"... failed (this is not fatal)
 Running "install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf "... succeeded
Done.
grub> Done creation of installation USB for DL180

现在已经制作完成,重启系统进入bios选择U盘启动,就可以对XD的cell节点进行刷机

发表在 EXADATA | 评论关闭

ORACLE 12C RMAN recover table

12c的rman有了很大的增强,其中一个亮点就是可以进行table 级别的恢复,本试验测试了rman基于时间点恢复一个被删除表的操作过程
数据库版本

SQL> select * from v$version; 

BANNER                                                                               CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.0.2 - 64bit                         0
PL/SQL Release 12.1.0.0.2                                                                 0
CORE    12.1.0.0.2                                                                        0
TNS for Linux: Version 12.1.0.0.2                                                         0
NLSRTL Version 12.1.0.0.2                                                                 0

创建表并插入数据

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2013-01-17 18:37:07

SQL> create table t_xifenfei(id number,insert_time date);

Table created.

SQL> insert into t_xifenfei values(1,sysdate);

1 row created.

SQL> commit;
Commit complete.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     53
Next log sequence to archive   55
Current log sequence           55

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2013-01-17 18:37:55

备份数据库

RMAN> backup  as compressed backupset database  format '/tmp/xifenfei_db_%U';

Starting backup at 17-JAN-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=30 device type=DISK
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/xifenfei/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/xifenfei/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/xifenfei/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/xifenfei/xifenfei01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/xifenfei/users01.dbf
channel ORA_DISK_1: starting piece 1 at 17-JAN-13
channel ORA_DISK_1: finished piece 1 at 17-JAN-13
piece handle=/tmp/xifenfei_db_07nvln1g_1_1 tag=TAG20130117T183839 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting compressed full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 17-JAN-13
channel ORA_DISK_1: finished piece 1 at 17-JAN-13
piece handle=/tmp/xifenfei_db_08nvln3r_1_1 tag=TAG20130117T183839 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 17-JAN-13

插入数据继续测试

SQL> insert into t_xifenfei values(2,sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL> alter system switch logfile;

System altered.

SQL> alter system switch logfile;

System altered.

SQL> insert into t_xifenfei values(3,sysdate);

1 row created.

SQL> insert into t_xifenfei values(4,sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     55
Next log sequence to archive   57
Current log sequence           57

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2013-01-17 18:41:17

SQL> select id,to_char(insert_time,'yyyy-mm-dd hh24:mi:ss') from t_xifenfei;

        ID TO_CHAR(INSERT_TIME
---------- -------------------
         1 2013-01-17 18:37:22
         2 2013-01-17 18:40:37
         3 2013-01-17 18:40:58
         4 2013-01-17 18:40:59

删除测试表

SQL> drop table t_xifenfei purge;

Table dropped.

SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'YY
-------------------
2013-01-17 18:41:36

rman recover table

[oracle@Lunar tmp]$ rman target sys/xifenfei log=/tmp/recover_table.log
RMAN> RECOVER TABLE XFF."T_XIFENFEI" 
until time  "to_date('2013-01-17 18:41:17','yyyy-mm-dd hh24:mi:ss')"
AUXILIARY DESTINATION '/tmp/recovertable'
REMAP TABLE 'XFF'.'T_XIFENFEI':'T_XIFENFEI_NEW';
--recover table XFF.T_XIFENFEI data impdp into XFF.T_XIFENFEI_NEW

验证数据库

SQL> select id,to_char(insert_time,'yyyy-mm-dd hh24:mi:ss') from t_xifenfei_new;

        ID TO_CHAR(INSERT_TIME
---------- -------------------
         1 2013-01-17 18:37:22
         2 2013-01-17 18:40:37
         3 2013-01-17 18:40:58
         4 2013-01-17 18:40:59

补充说明
1.rman recover table 必须使用sys用户登录,而不能使用/,因为12c默认有backup用户
2.rman recover table 需要还原system,undo,sysaux表空间,需要还原表所在表空间,和expdp导出文件空间,所以需要额外空间较大
3.整体恢复过程是:还原system,undo,sysaux表空间,然后read only数据库,然后重启数据库还原表所在表空间,然后expdp导出表,根据需要决定是否导入表到数据库
4.完整的rman recover table执行过程脚本recover_table

发表在 Oracle, ORACLE 12C | 2 条评论

Swingbench简单使用

Swingbench是一款很不错的oracle压力测试工具,使用比较简单,而且很效果比较明显,可以满足在一些简单的测试案例中的需求,这里大概的写了主要的Swingbench测试过程中的一些注意事项
1.相关网站
Swingbench
2.上传服务器并解压

--整体目录
[oracle@localhost swingbench]$ ll
total 484
drwxr-xr-x. 3 oracle dba   4096 Mar 26 15:54 bin
drwxr-xr-x. 2 oracle dba   4096 Mar 26 15:48 configs
drwxr-xr-x. 2 oracle dba   4096 Jun 11  2010 launcher
drwxr-xr-x. 3 oracle dba   4096 Dec  9  2011 lib
drwxr-xr-x. 2 oracle dba   4096 Mar  3  2010 log
-rwx------. 1 oracle dba   1768 Feb 15  2011 README.txt
drwxr-xr-x. 3 oracle dba   4096 Dec  9  2011 source
drwxr-xr-x. 2 oracle dba   4096 Mar 26 15:38 sql
-rw-r--r--. 1 oracle dba    848 Mar 26 11:02 swingbench.env
-rw-r--r--. 1 oracle dba 454110 Feb 15  2011 swingbenchFAQ.pdf
drwx------. 3 oracle dba   4096 Dec  8  2011 winbin

--动态库
[oracle@localhost lib]$ ll
total 14896
-rw-r--r--. 1 oracle dba   999966 Dec  9  2011 ant.jar
drwxr-xr-x. 2 oracle dba     4096 Dec  9  2011 launcher
-rw-r--r--. 1 oracle dba  2152849 Dec  9  2011 ojdbc6.jar
-rw-r--r--. 1 oracle dba    70569 Dec  9  2011 ons.jar
-rw-r--r--. 1 oracle dba    20349 Dec  9  2011 simplefan.jar
-rw-r--r--. 1 oracle dba 11512178 Dec  9  2011 swingbench.jar
-rw-r--r--. 1 oracle dba   479413 Dec  9  2011 ucp.jar

--相关执行文件和初始化*.xml文件等
[oracle@localhost bin]$ ll
total 192
-rwxr-xr-x. 1 oracle dba    106 Nov 17  2010 bmcompare
-rwx------. 1 oracle dba   4456 Apr 19  2010 ccconfig.xml
-rwxr-xr-x. 1 oracle dba    120 Nov 17  2010 ccwizard
-rwx------. 1 oracle dba   4086 Jul 27  2010 ccwizard.xml
-rwxr-xr-x. 1 oracle dba    106 Nov 17  2010 charbench
-rwxr-xr-x. 1 oracle dba    118 Nov 17  2010 clusteroverview
-rw-r--r--. 1 oracle dba   1740 Jul 27  2010 clusteroverview.xml
-rwxr-xr-x. 1 oracle dba    110 Nov 17  2010 coordinator
drwxr-xr-x. 2 oracle dba   4096 Dec  8  2011 data
-rw-r--r--. 1 oracle dba 113698 Nov  2  2011 debug.log
-rwxr-xr-x. 1 oracle dba    106 Nov 17  2010 minibench
-rwxr-xr-x. 1 oracle dba    120 Nov 17  2010 oewizard
-rwx------. 1 oracle dba   3279 Jul 27  2010 oewizard.xml
-rw-r--r--. 1 oracle dba   2790 Feb 15  2011 results.xml
-rwxr-xr-x. 1 oracle dba    128 Nov 17  2010 shwizard
-rwx------. 1 oracle dba   2499 Aug 28  2010 shwizard.xml
-rwxr-xr-x. 1 oracle dba    108 Nov 17  2010 swingbench
-rwx------. 1 oracle dba   5766 Mar 26 15:29 swingconfig.xml
-rw-r--r--. 1 oracle dba    241 Mar 26 11:56 wizardlog.xml

--执行相关*.xml配置文件
[oracle@localhost configs]$ ll
total 36
-rwx------. 1 oracle dba 4714 Mar 27 10:02 ccconfig.xml
-rwx------. 1 oracle dba 3950 Nov  8  2011 oeconfig.xml
-rwx------. 1 oracle dba 3774 Nov  8  2011 shconfig.xml
-rwx------. 1 oracle dba 5009 Mar 27 10:15 soeconfig.xml
-rwx------. 1 oracle dba 3198 Nov  8  2011 spconfig.xml
-rwx------. 1 oracle dba 3074 Mar 23  2010 stresstest.xml

3.编辑环境变量

--自己编辑生成,然后使用.执行
vi swingbench.env
#!/bin/bash
--note:官方要求java 1.6,oracle 11g自带1.5可以执行
export JAVAHOME=/data/oracle/product/11.2.0/dbhome_1/jdk
export SWINGHOME=/swingbench 
export ORACLE_HOME=/data/oracle/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib:$SWINGHOME/lib
export CLASSPATH=$JAVAHOME/lib/rt.jar:$JAVAHOME/lib/tools.jar:${SWINGHOME}/lib/swingbench.jar
export CLASSPATH=$CALSSPATH:${SWINGHOME}/lib/ojdbc6.jar:${SWINGHOME}/lib/ant.jar:ucp.jar
export CLASSPATH=$CLASSPATH:$ORACLE_HOME/jdbc/lib/ojdbc14.jar:$ORACLE_HOME/opmn/lib/ons.jar
export CLASSPATH=$CLASSPATH:$ORACLE_HOME/jdbc/lib/ojdbc5.jar

4.初始化数据

--初始化sh数据
[oracle@localhost bin]$ ll sh*
-rwxr-xr-x. 1 oracle dba  128 Nov 17  2010 shwizard
-rwx------. 1 oracle dba 2499 Aug 28  2010 shwizard.xml

--初始化soe数据
[oracle@localhost bin]$ ll oe*
-rwxr-xr-x. 1 oracle dba  120 Nov 17  2010 oewizard
-rwx------. 1 oracle dba 3279 Jul 27  2010 oewizard.xml

--初始化cc数据
[oracle@localhost bin]$ ll ccwizard*
-rwxr-xr-x. 1 oracle dba  120 Nov 17  2010 ccwizard
-rwx------. 1 oracle dba 4086 Jul 27  2010 ccwizard.xml

5.执行压力测试

--执行sh
[oracle@localhost bin]$ ./swingbench -c /swingbench/configs/shconfig.xml

--执行soe
[oracle@localhost bin]$ ./swingbench -c /swingbench/configs/soeconfig.xml

--执行cc
[oracle@localhost bin]$ ./swingbench -c /swingbench/configs/ccconfig.xml

6.测试结果
为了能够收集系统的io和cpu,需要登录系统(configuration–>connect pooling–>distributed controls)

发表在 Oracle | 一条评论