Migrate Windows 7 KVM virtual machine to Virtualbox

Hi folks, here is me again posting tips about virtualization instead of database management stuff. I’m doing this specially to document stuff I had to deal with that I’m pretty sure I won’t be doing any time soon. This is one of such things, move a Windows 7 VM from KVM to Virtualbox… so let’s get to it, shall we?

First thing you might be interested to do is changing the type of hard drive used in KVM to IDE. If you have problems, check this out:
https://support.microsoft.com/en-us/kb/922976

The second thing is to convert the disk image from KVM to RAW using qemu.

# qemu-img convert -O raw Windows_7-KVM.qcow2 Windows_7VBOX.raw

Once the RAW disk is created, now it is necessary to convert it to VDI using VBoxManage.

# VBoxManage convertfromraw -format VDI Windows_7VBOX.raw /home/user/Windows_7VBOX.vdi
Converting from raw image file="Windows_7VBOX.raw" to file="/home/user/Windows_7VBOX.vdi"...
Creating dynamic image with size 85899345920 bytes (81920MB)...

Since I have been doing everything as root, I will now change the owner for the disk to my non-privileged user.

# chown user:group /home/brunomc/Windows_7VBOX.vdi

Finally we can create a VM on Virtualbox using the converted disk. Here is a brief overview:

Open up virtualbox and click on create virtual machine. Enter a name for the machine and click “Next”.
screenshot-create-virtual-machine

Select the amount of memory for the machine and click “Next”. In my example 3GB of RAM.
screenshot-create-virtual-machine-1

Now the most important part for this article, select the existing disk and locate your converted VDI.
screenshot-create-virtual-machine-2

Start the VM and check if it is working fine. Hope this helps ūüôā

Posted in Virtualization | Tagged , , , , , , , , , | 2 Comments

RAC 11gR2: Change SCAN VIP subnet

First of all, check whether your DNS servers is resolving to the new IPs. This is usually done by a network administrator.

[oracle@rac2 ~]$ nslookup rac-scan
Server:        144.180.76.91
Address:    144.180.76.91#53

Name:    rac-scan.localdomain
Address: 144.180.76.121
Name:    rac-scan.localdomain
Address: 144.180.76.123
Name:    rac-scan.localdomain
Address: 144.180.76.122

Now from grid home check the current scan configuration.

[oracle@rac2 ~]$ srvctl config scan
SCAN name: rac-scan, Network: 1/144.180.76.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /192.168.1.121/192.168.1.121
SCAN VIP name: scan2, IP: /192.168.1.123/192.168.1.123
SCAN VIP name: scan3, IP: /192.168.1.122/192.168.1.122

As you can see the IPs are in a different subnet. To change it logon as root and modify the scan.

[root@rac2 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan -n rac-scan

Now, bring the SCAN back online…

[oracle@rac2 ~]$ srvctl start scan
[oracle@rac2 ~]$ srvctl start scan_listener

Confirm the IPs changed…

[oracle@rac2 ~]$ srvctl config scan
SCAN name: rac-scan, Network: 1/144.180.76.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /rac-scan.localdomain/144.180.76.122
SCAN VIP name: scan2, IP: /rac-scan.localdomain/144.180.76.121
SCAN VIP name: scan3, IP: /rac-scan.localdomain/144.180.76.123

That’s it. For further information you can refer to Doc ID 952903.1.

Posted in ORACLE Database | Tagged , , , , , , | Leave a comment

RAC 11g R2: CRS-5008: Invalid attribute value

Hi folks, I recently had to change the public IP address for the RAC. All went well except the VIPs and the network stopped working. Here is what I got from crsctl status:

[root@rac2 ~]# /u01/app/11.2.0/grid/bin/crsctl status res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
 ONLINE ONLINE rac1
 ONLINE ONLINE rac2
 ONLINE ONLINE rac3
ora.DATA_01.dg
 ONLINE ONLINE rac1
 ONLINE ONLINE rac2
 ONLINE ONLINE rac3
ora.DATA_02.dg
 OFFLINE OFFLINE rac1
 OFFLINE OFFLINE rac2
 OFFLINE OFFLINE rac3
ora.LISTENER.lsnr
 ONLINE ONLINE rac1
 ONLINE ONLINE rac2
 ONLINE ONLINE rac3
ora.asm
 ONLINE ONLINE rac1 Started
 ONLINE ONLINE rac2 Started
 ONLINE ONLINE rac3 Started
ora.eons
 ONLINE ONLINE rac1
 ONLINE ONLINE rac2
 ONLINE ONLINE rac3
ora.gsd
 ONLINE ONLINE rac1
 ONLINE ONLINE rac2
 ONLINE ONLINE rac3
ora.net1.network
 ONLINE OFFLINE rac1
 ONLINE OFFLINE rac2
 ONLINE OFFLINE rac3
ora.ons
 ONLINE ONLINE rac1
 ONLINE ONLINE rac2
 ONLINE ONLINE rac3
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
 1 ONLINE ONLINE rac2
ora.LISTENER_SCAN2.lsnr
 1 ONLINE ONLINE rac2
ora.LISTENER_SCAN3.lsnr
 1 ONLINE ONLINE rac2
ora.rac1.vip
 1 ONLINE OFFLINE
ora.rac2.vip
 1 ONLINE OFFLINE
ora.rac3.vip
 1 ONLINE OFFLINE
ora.scan1.vip
 1 ONLINE OFFLINE
ora.scan2.vip
 1 ONLINE OFFLINE
ora.scan3.vip
 1 ONLINE OFFLINE
ora.tsp.db
 1 OFFLINE OFFLINE
 2 OFFLINE OFFLINE
 3 OFFLINE OFFLINE
ora.tsp.orderentryworkload.svc
 1 OFFLINE OFFLINE
 2 OFFLINE OFFLINE
 3 OFFLINE OFFLINE

Trying to start it manually failed…

[oracle@rac2 ~]$ srvctl start nodeapps
PRKO-2419 : GSD is already started on node(s): rac1,rac2,rac3
PRCR-1079 : Failed to start resource ora.net1.network
CRS-2674: Start of 'ora.net1.network' on 'rac3' failed
CRS-2674: Start of 'ora.net1.network' on 'rac1' failed
CRS-2674: Start of 'ora.net1.network' on 'rac2' failed
PRCR-1079 : Failed to start resource ora.rac1.vip
CRS-2674: Start of 'ora.net1.network' on 'rac1' failed
CRS-2674: Start of 'ora.net1.network' on 'rac2' failed
CRS-2674: Start of 'ora.net1.network' on 'rac3' failed
CRS-2632: There are no more servers to try to place resource 'ora.rac1.vip' on that would satisfy its placement policy
PRCR-1079 : Failed to start resource ora.rac2.vip
CRS-2674: Start of 'ora.net1.network' on 'rac2' failed
CRS-2674: Start of 'ora.net1.network' on 'rac3' failed
CRS-2674: Start of 'ora.net1.network' on 'rac1' failed
CRS-2632: There are no more servers to try to place resource 'ora.rac2.vip' on that would satisfy its placement policy
PRCR-1079 : Failed to start resource ora.rac3.vip
CRS-2674: Start of 'ora.net1.network' on 'rac3' failed
CRS-2674: Start of 'ora.net1.network' on 'rac2' failed
CRS-2674: Start of 'ora.net1.network' on 'rac1' failed
CRS-2632: There are no more servers to try to place resource 'ora.rac3.vip' on that would satisfy its placement policy
PRKO-2422 : ONS is already started on node(s): rac1,rac2,rac3
PRKO-2423 : eONS is already started on node(s): rac1,rac2,rac3

To troubleshoot it I first double checked oifcfg…

[root@rac2 ~]# /u01/app/11.2.0/grid/bin/oifcfg iflist
eth0 144.180.76.0
eth1 9.11.3.0
[root@rac2 ~]# /u01/app/11.2.0/grid/bin/oifcfg getif
eth0 144.180.76.0 global public
eth1 9.11.3.0 global cluster_interconnect

Then I moved on to test the DNS for both name resolution and reverse lookups…

[root@rac2 ~]# nslookup rac-scan
Server: 144.180.76.91
Address: 144.180.76.91#53

Name: rac-scan.localdomain
Address: 144.180.76.121
Name: rac-scan.localdomain
Address: 144.180.76.122
Name: rac-scan.localdomain
Address: 144.180.76.123

[root@rac2 ~]# nslookup 144.180.76.111
Server: 144.180.76.91
Address: 144.180.76.91#53

111.76.180.144.in-addr.arpa name = rac1-vip.localdomain.

Time to look for the logs where I finally found a hint on what might be the problem… “CRS-5008: Invalid attribute value: eth0”

[root@rac2 ~]# tail -n 15 /u01/app/11.2.0/grid/log/rac2/agent/crsd/orarootagent_root/orarootagent_root.log
2016-09-11 21:09:18.141: [ora.net1.network][1324865856] [check] NetworkAgent::checkInterface returned false
2016-09-11 21:09:18.141: [ora.net1.network][1324865856] [check] NetInterface::checkLinkStatus error 0
2016-09-11 21:09:18.141: [ora.net1.network][1324865856] [check] NetInterface::checkLinkStatus error 0
2016-09-11 21:09:18.145: [ora.net1.network][1324865856] [check] NetworkAgent::checkLink returned false
2016-09-11 21:09:18.183: [ AGFW][1324865856] check for resource: ora.net1.network rac2 1 completed with status: OFFLINE
2016-09-11 21:09:18.183: [ AGFW][1324865856] Executing command: check for resource: ora.net1.network rac2 1
2016-09-11 21:09:18.183: [ora.net1.network][1324865856] [check] NetworkAgent::init enter {
2016-09-11 21:09:18.183: [ora.net1.network][1324865856] [check] Checking if eth0 Interface is fine
2016-09-11 21:09:18.185: [ AGFW][1358424384] CHECK initiated by timer for: ora.net1.network rac2 1
2016-09-11 21:09:18.188: [ora.net1.network][1324865856] [check] ifname=eth0
2016-09-11 21:09:18.189: [ora.net1.network][1324865856] [check] subnetmask=255.255.255.0
2016-09-11 21:09:18.189: [ora.net1.network][1324865856] [check] subnetnumber=144.180.76.0
2016-09-11 21:09:18.189: [ora.net1.network][1324865856] [check] CRS-5008: Invalid attribute value: eth0 for the network interface
2016-09-11 21:09:18.189: [ora.net1.network][1324865856] [check] NetworkAgent::init exit }

Checking the status of resource ora.net1.network I found a very strange thing, the SUBNET was incorrect…

[root@rac2 ~]# /u01/app/11.2.0/grid/bin/crsctl status resource ora.net1.network -p
NAME=ora.net1.network
TYPE=ora.network.type
ACL=owner:root:rwx,pgrp:root:r-x,other::r--,group:oinstall:r-x,user:oracle:r-x
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
AGENT_FILENAME=%CRS_HOME%/bin/orarootagent%CRS_EXE_SUFFIX%
ALIAS_NAME=
AUTO_START=restore
CHECK_INTERVAL=1
DEFAULT_TEMPLATE=
DEGREE=1
DESCRIPTION=Oracle Network resource
ENABLED=1
LOAD=1
LOGGING_LEVEL=1
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=60
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=60
START_DEPENDENCIES=
START_TIMEOUT=0
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=
STOP_TIMEOUT=0
UPTIME_THRESHOLD=1d
USR_ORA_AUTO=
USR_ORA_ENV=
USR_ORA_IF=eth0
USR_ORA_NETMASK=255.255.255.0
USR_ORA_SUBNET=192.168.1.0
VERSION=11.2.0.1.0

I’ve then modified the attribute USR_ORA_SUBNET to match the actual subnet and checked the new status

[root@rac2 ~]# /u01/app/11.2.0/grid/bin/crsctl modify resource ora.net1.network -attr "USR_ORA_SUBNET=144.180.76.0"
[root@rac2 ~]# /u01/app/11.2.0/grid/bin/crsctl status resource ora.net1.network -p
NAME=ora.net1.network
TYPE=ora.network.type
ACL=owner:root:rwx,pgrp:root:r-x,other::r--,group:oinstall:r-x,user:oracle:r-x
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
AGENT_FILENAME=%CRS_HOME%/bin/orarootagent%CRS_EXE_SUFFIX%
ALIAS_NAME=
AUTO_START=restore
CHECK_INTERVAL=1
DEFAULT_TEMPLATE=
DEGREE=1
DESCRIPTION=Oracle Network resource
ENABLED=1
LOAD=1
LOGGING_LEVEL=1
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=60
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=60
START_DEPENDENCIES=
START_TIMEOUT=0
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=
STOP_TIMEOUT=0
UPTIME_THRESHOLD=1d
USR_ORA_AUTO=
USR_ORA_ENV=
USR_ORA_IF=eth0
USR_ORA_NETMASK=255.255.255.0
USR_ORA_SUBNET=144.180.76.0
VERSION=11.2.0.1.0

To my surprise, when I tried to bring them up, everything was running fine. Of course if we look a while there are two attributes that probably took care of it:
OFFLINE_CHECK_INTERVAL=60
RESTART_ATTEMPTS=5

My conclusion is that it reached the threshold of 60 seconds and checked again it it was offline and tried to restart (it would keep trying and would be in that loop until it was solved). I didn’t test it thou, so it is just a guess… feel free to test it ūüôā

In summary: The root cause was the incorrect value for attribute USR_ORA_NETMASK on resource ora.net1.network. After adjusting it, everything got back to normal.

Posted in ORACLE Database | Tagged , , , , , , , | 3 Comments

Linux: Extend LVM by adding disk

Here is the current scenario: /u01 is under a LVM which is running out of space. The idea is to add space by adding a new disk (since this is a virtual machine, the disk being added is 15GB only)

Here is the initial output of df -h:

[root@demodb11g ~]# df -h
Filesystem            Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       27G  3.6G   22G  15% /
/dev/sda1              99M   24M   71M  25% /boot
tmpfs                 676M     0  676M   0% /dev/shm
repo                  146G  130G   17G  89% /media/share
/dev/mapper/VolDatabase00-lvol0
                       29G   26G  1.7G  94% /u01

Once the new disk is connected to the server, let’s partition it with fdisk:

[root@demodb11g ~]# fdisk /dev/sdf
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklab el
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 1958.
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): n
Command action
 e extended
 p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1958, default 1): <Enter>
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1958, default 1958): <Enter>
Using default value 1958

Command (m for help): type
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

You can get the LVM and VG information from lvdisplay, here is an example:

[root@demodb11g ~]# lvdisplay
 --- Logical volume ---
 LV Name /dev/VolDatabase00/lvol0
 VG Name VolDatabase00
 LV UUID i0u35c-oMrd-0tB1-3H0n-YBIa-Meno-XmCOXZ
 LV Write Access read/write
 LV Status available
 # open 1
 LV Size 29.00 GB
 Current LE 7423
 Segments 4
 Allocation inherit
 Read ahead sectors auto
 - currently set to 256
 Block device 253:2

Now to start extending with the new disk, we use vgextend <VG name> </path/disk>

[root@demodb11g ~]# vgextend VolDatabase00 /dev/sdf1
 No physical volume label read from /dev/sdf1
 Writing physical volume data to disk "/dev/sdf1"
 Physical volume "/dev/sdf1" successfully created
 Volume group "VolDatabase00" successfully extended

We can check the new disk is added using pvscan:

[root@demodb11g ~]# pvscan
 PV /dev/sdb1 VG VolDatabase00 lvm2 [4.99 GB / 0 free]
 PV /dev/sdc1 VG VolDatabase00 lvm2 [4.99 GB / 0 free]
 PV /dev/sdd1 VG VolDatabase00 lvm2 [4.99 GB / 1000.00 MB free]
 PV /dev/sde1 VG VolDatabase00 lvm2 [15.00 GB / 0 free]
 PV /dev/sdf1 VG VolDatabase00 lvm2 [15.00 GB / 15.00 GB free]
 PV /dev/sda2 VG VolGroup00 lvm2 [29.88 GB / 0 free]
 Total: 6 [74.84 GB] / in use: 6 [74.84 GB] / in no VG: 0 [0 ]

Now that the disk has been added to the Volume Group, we can extend the Logical Volume using lvextend <path/to/lv> <path/disk>

[root@demodb11g ~]# lvextend /dev/VolDatabase00/lvol0 /dev/sdf1
 Extending logical volume lvol0 to 43.99 GB
 Logical volume lvol0 successfully resized

Finally, we run the resize2fs (or xfs_growfs if you are using CentOS or Red Hat 7 or newer with XFS filesystem) in order to see the changes reflect to df. If you try to check df before executing resize2fs, you will still see the old sizes.

[root@demodb11g ~]# resize2fs /dev/VolDatabase00/lvol0
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolDatabase00/lvol0 is mounted on /u01; on-line resizing required
Performing an on-line resize of /dev/VolDatabase00/lvol0 to 11532288 (4k) blocks.
The filesystem on /dev/VolDatabase00/lvol0 is now 11532288 blocks long.

That completes the resize!

[root@demodb11g ~]# df -h
Filesystem            Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       27G  3.6G   22G  15% /
/dev/sda1              99M   24M   71M  25% /boot
tmpfs                 676M     0  676M   0% /dev/shm
repo                  146G  130G   17G  89% /media/share
/dev/mapper/VolDatabase00-lvol0
                       44G   26G  16G  62% /u01
Posted in Linux | Tagged , , , , , , , , , , | 2 Comments

Virtualization tip [EMC Data Domain] – Converting VMWare appliances (OVA, OVF/VMX) to import on Virtualbox

There are a couple of appliances that are nice to be deployed in a private test environment, such as HP Virtual Storage Appliance P4500, EMC Data Domain among others. Mere mortals like myself use Virtualbox at home, so these steps demonstrate how to convert such appliances to be run on Virtualbox instead of VMware ESXI or vSphere.

In this example I’ll be using EMC Data Domain appliance. The software required¬†are listed below:
1.) The OVF Tool:
https://my.vmware.com/web/vmware/details?productId=352&downloadGroup=OVFTOOL350
2.) VMWare Converter:
https://my.vmware.com/web/vmware/info?slug=infrastructure_operations_management/vmware_vcenter_converter_standalone/5_5
3.) The appliance itself, in this case data domain:
https://community.emc.com/community/products/data-domain

Now you have to start CMD and navigate to the folder where you installed the OVF Tool (Default path is c:\Program Files\VMware). Here is an example of a convertion from OVA to OVF and in the end the VMDK will be present as well.

c:\Program Files\VMware\VMware OVF Tool>ovftool.exe --allowExtraConfig "C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ova" "C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ovf"
Opening OVA source: C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ova
The manifest validates
Source is signed but could not verify certificate (possibly self-signed)
Opening OVF target: C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ovf
Writing OVF package: C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ovf
Transfer Completed
Warning:
 - ExtraConfig options exists in source.
Completed successfully

At this point you can create a VM and attach the VMDK for most cases. I’ll keep going to change a couple of things… so let’s move on to conversion from OVF to VMX.

Note:¬†I’ve changed the destination to the folder C:\Users\user\Documents to avoid conflicts with VMDK. I also added the –lax option to avoid the process from stopping due to errors that we can deal with later on.

c:\Program Files\VMware\VMware OVF Tool>ovftool.exe --allowExtraConfig --lax "C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ovf" "C:\Users\user\Documents\ddve-5.7.30.2-525061.vmx"
Opening OVF source: C:\Users\user\Documents\ddve-vsphere-5.7.30.2-525061\ddve-5.7.30.2-525061.ovf
The manifest validates
Opening VMX target: C:\Users\user\Documents\ddve-5.7.30.2-525061.vmx
Info: An end-user license agreement
License:

EMC Software License Agreement
 Free Software

IMPORTANT - PLEASE READ CAREFULLY
 This EMC Software License Agreement (the "Agreement") is a legal
 agreement between EMC Corporation, with a principal office at 176
 South Street, Hopkinton, MA 01748 USA ("EMC") and you and the
 organization on whose behalf you are accessing this Agreement (the
 "Customer") and governs Customer's access to, downloading of, and use
 of any and all components, associated media, printed materials,
 documentation, and programming accessed via the EMC software (the
 "Software").
 By clicking on the "Agree" or check box or similar button set forth
 below, or by downloading, installing, or using the Software, you are
 representing to EMC that (i) you are authorized to legally bind the
 Customer, and (ii) you are agreeing on behalf of the Customer that the
 terms of this Agreement shall govern the relationship of the parties
 with regard to the Software.
 If you do not have authority to agree to the terms of this Agreement,
 or do not accept the terms of this Agreement, click on the "Cancel" or
 similar button or discontinue your efforts to download the Software,
 .
 .
 .
 9.8 Separability - If any provision of this Agreement shall be held
 illegal or unenforceable, such provision shall be deemed separable
 from, and shall in no way affect or impair the validity or
 enforceability of, the remaining provisions.
 Free S/W NP Rev 20150518


Accept end-user license agreement?
Write 'yes' or 'no' (write 'read' to reread the EULA):
yes
Warning:
 - Hardware compatibility check is disabled.
 - Line 97: Unsupported virtual hardware device 'VirtualSCSI'.
Writing VMX file: C:\Users\user\Documents\ddve-5.7.30.2-525061.vmx
Progress: 9%

It will take some time depending on your hardware… in my case it took over 30 minutes.

Once it completes, open the vmware converter, click on “Convert machine”, select “powered off”, change the type to “VMware Workstation or other VMware virtual machine” and finally browse to where you saved the VMX file. The image below show exactly how to do it. After you’ve done these steps, click “Next”.

steps

Now just change the type to “VMware Workstation or other VMware virtual machine”, enter a name and a destination folder. Then click next.

steps2

On the next screen you can change configuration for your VM. I have left the defaults 2 vCPUs with 6GB of RAM… I just ¬†changed the NICs from Bridged to NAT because I prefer to have my VMs on a different subnet. But that’s up to you. Just click next and you will see the summary screen like in the image below. Just click Finish to start the actual convertion.

steps4

Wait for the job to complete…

job

Create a VM on Virtualbox using the same settings (2 vCPUs, 6GB of RAM and 2 NICs in Bridge mode or NAT depending on your network) and attach the 2 VMDKs to a SATA controller. In the image below is an example of my setup.

datadomain

Now you just have to start the VM. It may take a long time to perform the first boot.

dd

Hope this helps…

Posted in Virtualization | Tagged , , , , , , , , , , , , | Leave a comment

Move RAC database from one diskgroup to another in ASM (Manually)

This approach is quite annoying because it has a lot of steps and things to consider, yet here goes a summary of how it could be done in a 3 node RAC as example:

Scenario: Database is TSP, instances are TSP1, TSP2 and TSP3. Everything is under +DATA and will be moved to +DATA_01.

We can start with the datafiles one by one to minimize downtime, in the example below I’m using RMAN to do it just to do it from a single point, you can do it from SQL*Plus without problems, will work just the same. I’ll leave SYSTEM and SYSAUX for the end because downtime will be needed.

-- Move common datafiles
rman target = /
sql 'alter database datafile 3 offline';
copy datafile 3 to '+DATA_01';
switch datafile 3 to copy;
recover datafile 3;
sql 'alter database datafile 3 online';

Now let’s move on to temporary tablespaces.

-- Temporary Tablespaces
sqlplus / as sysdba
CREATE TEMPORARY TABLESPACE temp2 TEMPFILE '+DATA_01' SIZE 64M REUSE AUTOEXTEND ON NEXT 28 MAXSIZE unlimited;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2
DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES;

Moving on to Undo tablespaces…

-- Undo tablespaces
-- Node 1
sqlplus / as sysdba
create undo tablespace undotbs01 datafile '+DATA_01' size 500m;
alter system set undo_tablespace='undotbs01';
alter system set undo_tablespace='UNDOTBS01' scope=SPFILE sid='TSP1';
drop tablespace undotbs1 including contents;
-- Node 2
sqlplus / as sysdba
create undo tablespace undotbs02 datafile '+DATA_01' size 500m;
alter system set undo_tablespace='undotbs02';
alter system set undo_tablespace='UNDOTBS02' scope=SPFILE sid='TSP2';
drop tablespace undotbs2 including contents;
-- Node 3
sqlplus / as sysdba
create undo tablespace undotbs03 datafile '+DATA_01' size 500m;
alter system set undo_tablespace='undotbs03';
alter system set undo_tablespace='UNDOTBS03' scope=SPFILE sid='TSP3';
drop tablespace undotbs3 including contents;

Now the redo log files… Please notice that I’m ommiting a few repetitive steps. No point in filling the same info over and over again.

-- Redo log files
sqlplus / as sysdba
alter system set db_create_online_log_dest_1='+DATA_01' scope=both sid='*';
set pages 200 lines 180
col member format a60
select l.group# , l.bytes , l.status , lf.member
from gv$logfile lf , gv$log l
where lf.group# = l.group#
group by l.group#,l.bytes,l.status,lf.member
order by 1;
-- Based on the select above, add new logfile to the inactive groups and drop old members
alter database add logfile member '+DATA_01' to group 1;
alter database add logfile member '+DATA_01' to group 4;
alter database add logfile member '+DATA_01' to group 6;
alter system switch logfile;
alter database add logfile member '+DATA_01' to group 2;
alter database add logfile member '+DATA_01' to group 3;
alter database add logfile member '+DATA_01' to group 5;
alter system switch logfile;
alter database drop logfile member '+DATA/tsp/onlinelog/group_1.261.906813393';
alter system switch logfile;
alter system checkpoint;
alter database drop logfile member '+DATA/tsp/onlinelog/group_5.267.906813567';
alter system switch logfile;
alter system checkpoint;
alter database drop logfile member '+DATA/tsp/onlinelog/group_6.268.906813567';

Now let’s move the SPFILE in a rolling manner, cool huh?

-- Move SPFILE
create pfile='/tmp/newpfile.ora' from spfile;
create spfile='+DATA_01' from pfile='/tmp/newpfile.ora';
-- Get new path and filename from ASMCMD and update the init.ora
$ sed -i -- "s/+DATA\/TSP\/spfileTSP.ora/+DATA_01\/TSP\/PARAMETERFILE\/spfile.306.920014799/g" $ORACLE_HOME/dbs/initTSP1.ora
$ ssh rac2 "sed -i -- \"s/+DATA\/TSP\/spfileTSP.ora/+DATA_01\/TSP\/PARAMETERFILE\/spfile.306.920014799/g\" $ORACLE_HOME/dbs/initTSP2.ora"
$ ssh rac3 "sed -i -- \"s/+DATA\/TSP\/spfileTSP.ora/+DATA_01\/TSP\/PARAMETERFILE\/spfile.306.920014799/g\" $ORACLE_HOME/dbs/initTSP3.ora"
srvctl modify database -d TSP -p +DATA_01/TSP/PARAMETERFILE/spfile.306.920014799
$ mv $ORACLE_HOME/dbs/spfileTSP1.ora $ORACLE_HOME/dbs/spfileTSP1.bkp
$ ssh rac2 "mv $ORACLE_HOME/dbs/spfileTSP2.ora $ORACLE_HOME/dbs/spfileTSP2.bkp"
$ ssh rac3 "mv $ORACLE_HOME/dbs/spfileTSP3.ora $ORACLE_HOME/dbs/spfileTSP3.bkp"
-- To avoid downtime, bounce each instance one at a time
$ srvctl stop instance -d TSP -i TSP1
$ srvctl start instance -d TSP -i TSP1
$ srvctl stop instance -d TSP -i TSP2
$ srvctl start instance -d TSP -i TSP2
$ srvctl stop instance -d TSP -i TSP3
$ srvctl start instance -d TSP -i TSP3

Now log on as root and go to your GRID_HOME to move the OCR and VD if that’s the case…

-- Move OCR to another disk group (as root, grid home)
# ocrconfig -add +DATA_01
# ocrconfig -delete +DATA
# ocrconfig -manualbackup

Now the voting disk:

-- Move Voting Disk (as root, grid home)
# crsctl query css votedisk
# crsctl replace votedisk +DATA_01

Now let’s do¬†the final step which involves the Control File, System ¬†and Sysaux tablespaces. This has been left to the end because downtime is required.

-- Check current control files
sqlplus / as sysdba
show parameter control_files
-- Change to the new diskgroup
alter system set control_files='+DATA_01' scope=spfile sid='*';
exit
$ srvctl stop database -d TSP
$ srvctl start instance -d TSP -i TSP1 -o NOMOUNT
rman target = /
restore controlfile from '+DATA/tsp/controlfile/current.260.906813391';
exit
$ srvctl stop instance -d TSP -i TSP1
$ srvctl start database -d TSP -o MOUNT
backup as copy datafile 1 format '+DATA_01';
switch datafile 1 to copy;
backup as copy datafile 2 format '+DATA_01';
switch datafile 2 to copy;
exit
srvctl stop database -d TSP
srvctl start database -d TSP

Finishing up… check anything you might have missed and move it ūüėČ

-- Check any remainder parameters to be adjusted
select name,value from v$parameter where value like ('%+DATA%');
-- Adjust the db_create_file_dest to new DG
alter system set db_create_file_dest='+DATA_01' scope=BOTH sid='*';
Posted in ORACLE Database | Tagged , , , , , , , , , , , , , | 2 Comments

How to add SCAN LISTENER in 11gR2

Very useful tip

Oracle Technologies Blog

My 11gR2 grid infrastructure completed with only one scan listener. The following log shows that ….

[grid@rac01 grid]$ srvctl config scan
SCAN name: rac-scan, Network: 1/133.22.38.0/255.255.255.0/eth2
SCAN VIP name: scan1, IP: /rac-scan.example.com/133.22.67.192
[grid@rac01 grid]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
[grid@rac01 grid]$

[grid@rac01 grid]$ ping rac-scan.example.com
PING rac-scan.example.com (133.22.67.193) 56(84) bytes of data.
From rac01.seo.int (133.22.38.50) icmp_seq=2 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=3 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=4 Destination Host Unreachable

‚ÄĒ rac-scan.example.com ping statistics ‚ÄĒ
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5000ms
, pipe 3
[grid@rac01 grid]$ ping rac-scan
PING rac-scan.example.com (133.22.67.194) 56(84) bytes of data.
From rac01.seo.int (133.22.38.50) icmp_seq=2 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=3 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=4 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=6 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=7 Destination Host Unreachable
From rac01.seo.int (133.22.38.50) icmp_seq=8 Destination Host Unreachable

View original post 1,816 more words

Posted in ORACLE Database | Leave a comment