tag:blogger.com,1999:blog-74612338463216409622024-03-13T02:41:41.709+00:00Oracle Performance and Backup BlogPerformance and Backup in Oracle databases. Looking for bottle-neck and using Oracle wait interface. News from Oracle world. Trick and tips for Oracle database.Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.comBlogger135125tag:blogger.com,1999:blog-7461233846321640962.post-59692223185086441312015-09-30T17:36:00.002+01:002015-10-01T19:16:43.651+01:00Automation for DBA - Ansible part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Hello,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">In this post I would like to move forward with software provisioning and configuration. In my last post I covered a ways to build a "core VM" and now it's a time to add some software and configuration to it. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">There are couple of automation tools, which can be used for that task like Puppet, Chef or Ansible to name a few. The latter one - <a href="https://github.com/ansible/ansible">Ansible</a> - is my favorite, cause </span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"> in my opinion </span>it has shortest learning curve and also doesn't require any agents on the remote servers.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Although there are some <a href="http://docs.ansible.com/ansible/intro_installation.html#managed-node-requirements">requirements</a> which has to be met on the remote servers:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- ssh connectivity to the remote host</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- Python 2.4 ( with python-simplejson ) or 2.5 installed on the remote host.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">If Python is a "big no-no" in your organization, you can still you Ansible to help you run a script over set of servers but you will loose almost all functionality.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<b><span style="font-family: Arial,Helvetica,sans-serif;">How Ansible works:</span></b><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Ansible has a concept of the control machine and a remote managed servers. Ansible scripts are started on the control machine and other servers are managed over a SSH connection and Ansible modules send to the remote servers on demand. Ansible can run in the fully automated mode only if control machine and remote servers has a password-less SSH configuration. In the other case Ansible can ask for a SSH password.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">The control machine can be a dedicated sever or it can be an OS admin or DBA laptop, where Ansible is installed. Please check <a href="http://docs.ansible.com/ansible/intro_installation.html#installing-the-control-machine">Ansible documentation</a> to find a information how to install it.<b> </b></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Inventory</b> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Remote servers can be managed from control machine, only if they are added into a Ansible <a href="http://docs.ansible.com/ansible/intro_inventory.html">inventory</a>. The inventory is a text file with the following format:</span><br />
<pre>testdb.mycompany.com
[testgroup]
envtest ansible_ssh_host=172.16.180.190 ansible_ssh_user=oracle
[proddb-group]
rac1.mycompany.com
rac2.mycompany.com
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">There are two groups in inventory file - testdbgroup with one members envtest, and proddb-group with two members rac1 and rac2. Server - testdb - is listed in the inventory file but it not a part of any group.<b> </b></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Variables</b></span>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Ansible has a concept of host and group variables. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Group
variables are used for all host defined in the a group. There is a
directory called group_vars, containing a files named with a group name.
Each file is a set of variables for a particular group. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Host variables are used for a particular host only and they overwrite a group variables. There is a directory called host_vars, </span><span style="font-family: Arial,Helvetica,sans-serif;">containing a files named with a host name. Each file is a set of variables for a particular host.</span><br />
<br />
<pre>$ ls -l host_vars/
total 24
-rw-r--r-- 1 mprzepiorowski staff 29 Sep 29 12:44 envtest
$ cat host_vars/envtest
password: "host env password"
$ ls -l group_vars/
total 8
-rw-r--r-- 1 mprzepiorowski staff 23 Sep 29 13:10 testgroup
$ cat group_vars/testgroup
groupname: "Test group"</pre>
<pre> </pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Server envtest has a file with host variables and it belongs to the group testgroup with a defined variables as well. Both will be used in the following example. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><b>Running mode </b></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">There are three ways of running a remote command:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- single command mode, </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- Ansible playbooks </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- Ansible playbooks with roles </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">and commands or playbooks can be run on the specific host from inventory file, specific group or all hosts.</span><br />
<br />
<b><span style="font-family: Arial,Helvetica,sans-serif;">Examples:</span></b><br />
<br />
<b><span style="font-family: Arial,Helvetica,sans-serif;">Single command:</span></b><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">In the first run Ansible can be used to add SSH public key from control machine into remote server. By default Ansible connect to the remote servers using a user running a command on the control machine, but this can be changed in the inventory file.</span><br />
<pre>$ cat inventory/lab
[testgroup]
envtest ansible_ssh_host=172.16.180.190 ansible_ssh_user=oracle
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Remote server has a user oracle and it will be used by all scripts. If remote server name "envtest" is not resolved by a DNS, IP address can be added to inventory file as well.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Test a SSH connection to remote host</span><br />
<pre>$ ssh oracle@172.16.180.190
oracle@172.16.180.190's password:
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Password is required and this is an example command to fix this problem</span><br />
<br />
<pre>$ ansible -k -i inventory/lab all -m authorized_key -a "user=oracle key=\"{{ lookup('file', '/Users/mprzepiorowski/.ssh/id_rsa.pub') }}\" "
SSH password:
envtest | success >> {
"changed": true,
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD43SwP3zXR/LrKqADJDC8jUOv0vgMEQVqWOXoUgwlzQ1vpS1I5m3GjXggG7fjU5I2jGbG+V9xSqPZdw4MGed4nsgOo1m68w9oBpfYLu3hKACSw1Tgu8Ghxd5TB9ohyZ7NOgepXB+zmV8NoqvAUg4yDkk4qPn1fQmoIz7yLkPRErnmSkI6e/gHsGAmZ+5WdvH0FByPCMEfHqDe8vI4ZPVbPWZzl5x9m72HtxjCbB2htHg1JEcch6927oiRE9rllbOL0M/tw5LgjCtYpM3iZTsBwFsGZ6NQ1DM+OiJSrDEhUqUMOZ08X/G7aNYb28QUt9G/FZTTwZjEfnOO75n3i29U/ mprzepiorowski@Marcins-MacBook-Pro.local",
"key_options": null,
"keyfile": "/home/oracle/.ssh/authorized_keys",
"manage_dir": true,
"path": null,
"state": "present",
"unique": false,
"user": "oracle"
}
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Command options:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- k - ask for SSH password</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- i inventory/lab - use a inventory file from folder inventory and file name called lab</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">all - run this command for all hosts from inventory file</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">-m authorized_key - use Ansible module <a href="http://docs.ansible.com/ansible/authorized_key_module.html">authorized_key</a></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- a "user=oracle, key=xxxxxxxx" - Ansible module parameters </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Command output:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- changed : true - remote system has been changed due to Ansible call</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- envtest | success - action returned OK status</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- other lines are depend on the module</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Ansible returned OK status so now SSH connection should work without password:</span><br />
<pre>$ ssh oracle@172.16.180.190
Last login: Mon Sep 28 15:58:24 2015 from 172.16.180.1
[oracle@envtest ~]$
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Ansible did a work and SSH public key has been added to user configuration on the remote server. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Single command is a nice feature if you want to run single command across fleet of servers, but for most of cases Ansible playbook will be a way to deal with.</span>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<b><span style="font-family: Arial,Helvetica,sans-serif;">Ansible playbook:</span></b><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Next example will show how to create a simple playbook with an one task and install a vim package using yum</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Playbook file is formatted in <a href="https://en.wikipedia.org/wiki/YAML">YAML </a>and it looks like this:</span><br />
<pre>---
- hosts: all
tasks:
- name: install vim
sudo: yes
yum: name=vim state=present
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Be aware that YAML file syntax include a white space, so format of this file matter as well. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Line description: </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Hosts: all - mean run a playbook for all hosts from inventory file</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">tasks: - is a start of task lists (one task in this example)</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">name: - start of task definition</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">sudo: - run this module using sudo</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">yum: - module name with parameters (name is a package to install, state=present mean install it)</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Ansible playbook can be stated using this command:</span><br />
<pre>$ ansible-playbook yum.yml -i inventory/lab
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [envtest]
TASK: [install vim] ***********************************************************
changed: [envtest]
PLAY RECAP ********************************************************************
envtest : ok=2 changed=1 unreachable=0 failed=0
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Where -i is pointing to the inventory file and yum.yml is a name of file with playbook definition. Output contains a list of tasks executed and summary with number of successes, changes and failures. </span><br />
<br />
<b><span style="font-family: Arial,Helvetica,sans-serif;">Ansible playbook and variables:</span></b><br />
<b><span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></b><span style="font-family: Arial,Helvetica,sans-serif;">In the all previous examples, only has host has been used and there was no variables set. Let's add some more complexity to playbook and show how flexible is Ansible. Both variables defined for particular host and group will be used to create a text file based on template.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Template file (</span><span style="font-family: Arial,Helvetica,sans-serif;"> Ansible supports <a href="http://jinja.pocoo.org/docs/">Jinja2</a> template language)</span><br />
<pre>$ cat template.j2
Host name is {{ ansible_hostname }}
Host var password is set to {{ password }}
Group var groupname is set to {{ groupname }}
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Ansible playbook:</span><br />
<pre>$ cat template.yml
---
- hosts: all
tasks:
- name: generate scripts
template: src=template.j2 dest=/tmp/output mode=0644
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Running playbook:</span><br />
<pre>$ ansible-playbook -i inventory/lab template.yml
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [envtest]
TASK: [generate scripts] ******************************************************
changed: [envtest]
PLAY RECAP ********************************************************************
envtest : ok=2 changed=1 unreachable=0 failed=0
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Output file on envtest server</span>
<br />
<pre>$ ssh oracle@172.16.180.190
Last login: Tue Sep 29 12:29:59 2015 from 172.16.180.1
[oracle@envtest ~]$ cat /tmp/output
Host name is envtest
Host var password is set to host env password
Group var groupname is set to Test group
[oracle@envtest ~]$
</pre>
<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">If you think that Ansible is difficult at that stage, and there is no use for DBA's wait until next blog post when I will use a <a href="https://github.com/oravirt/ansible-oracle">ansible-Oracle</a> playbooks to install Oracle on server changing only one files with a variables. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span> <br />
<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span><b><span style="font-family: Arial,Helvetica,sans-serif;"> </span></b><br />
<b><span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></b>
<b><span style="font-family: Arial,Helvetica,sans-serif;"> </span></b><br />
<br /></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-29752135528266236222015-09-20T11:54:00.000+01:002015-09-20T11:54:24.805+01:00Automation for DBA - Vagrant part 2<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Hello,</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">In the last post I presented steps to create Virtual Machine using Vagrant with Virtual Box. It is a native combination but there are other possibilities as well. This post will cover an integration of Vagrant tool with KVM hypervisor and AWS EC2 cloud.<br /><br />In both cases, an additional plugins has to be installed:<br />- vagrant-libvirt plugin for KVM - <a href="https://github.com/pradels/vagrant-libvirt">https://github.com/pradels/vagrant-libvirt</a><br />- vagrant-aws plugin for EC2 - <a href="https://github.com/mitchellh/vagrant-aws">https://github.com/mitchellh/vagrant-aws</a><br /><br />If there is a requirement to use a Vagrant boxes defined for other hypervisors, there is a plugin called vagrant-mutate, which help you to convert it from one format to another.<br /><b><br />KVM installation steps:</b><br /><br />Host configuration:<br />- Fedora 21<br />- QEMU emulator version 2.1.<br /><br /><br />List of plugins is maintain on this page - <a href="https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins">Available-Vagrant-Plugins</a><br /><br />Vagrant has very easy way to manage plugins. If plugin is listed on the official page installation process is limited to single command.</span>
<br />
<pre>[pioro@piorovm]$ vagrant plugin install vagrant-mutate
Installing the 'vagrant-mutate' plugin. This can take a few minutes...
Installed the plugin 'vagrant-mutate (1.0.1)'!
[pioro@piorovm]$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Installed the plugin 'vagrant-libvirt (0.0.30)'!
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Displaying a list of installed plugins with version. </span>
<br />
<pre>[pioro@piorovm]$ vagrant plugin list
vagrant-libvirt (0.0.30)
vagrant-mutate (1.0.1)
vagrant-share (1.1.4)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">As in the previous post a prebuild box racattack/oracle65 will be used. This box has been defined for Virtual Box so it has to be downloaded and migrated into KVM format. There is one caveat – after conversion new box will be still using a SATA drivers and not a native virtio drivers. If performance of Vagrant box is important, I will recommend creating a new native version of box for KVM configured with virtio.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Box racattack has two versions in official repository and mutate plugin was unable to use it directly. To workaround that issue a box has to be downloaded first using ex. wget. </span>
<br />
<pre>[pioro@piorovm ~]$ wget https://atlas.hashicorp.com/racattack/boxes/oracle65/versions/14.11.01/providers/virtualbox.box
--2015-08-19 23:33:57-- https://atlas.hashicorp.com/racattack/boxes/oracle65/versions/14.11.01/providers/virtualbox.box
Resolving atlas.hashicorp.com (atlas.hashicorp.com)... 107.23.224.212, 54.175.82.169
Connecting to atlas.hashicorp.com (atlas.hashicorp.com)|107.23.224.212|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.dropbox.com/s/ohj0wjhrwuhowoi/oracle6-racattack.14.11.01.box?dl=0 [following]
--2015-08-19 23:33:58-- https://dl.dropbox.com/s/ohj0wjhrwuhowoi/oracle6-racattack.14.11.01.box?dl=0
Resolving dl.dropbox.com (dl.dropbox.com)... 54.243.87.222
Connecting to dl.dropbox.com (dl.dropbox.com)|54.243.87.222|:443... connected.
HTTP request sent, awaiting response... 302 FOUND
Location: https://dl.dropboxusercontent.com/s/ohj0wjhrwuhowoi/oracle6-racattack.14.11.01.box?dl=0 [following]
--2015-08-19 23:33:58-- https://dl.dropboxusercontent.com/s/ohj0wjhrwuhowoi/oracle6-racattack.14.11.01.box?dl=0
Resolving dl.dropboxusercontent.com (dl.dropboxusercontent.com)... 107.21.214.189, 107.22.170.202, 107.22.227.179, ...
Connecting to dl.dropboxusercontent.com (dl.dropboxusercontent.com)|107.21.214.189|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1185789020 (1.1G) [application/octet-stream]
Saving to: ‘virtualbox.box’
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">In the next steps it will be renamed, converted and added to box's repository.</span>
<br />
<pre>[pioro@piorovm ~]$ mv virtualbox.box racattack.box
[pioro@piorovm ~]$ vagrant mutate racattack.box libvirt
Extracting box file to a temporary directory.
Converting racattack from virtualbox to libvirt.
(100.00/100%)
Cleaning up temporary files.
The box racattack (libvirt) is now ready to use.
[pioro@piorovm ~]$ vagrant box list
homeora65 (libvirt, 0)
precise32 (virtualbox, 0)
racattack (libvirt, 0)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Vagrant configuration is ready and a new Virtual Machine can be created. Like in the previous host a new directory will be created and a Vagrant will be initialized. In the next step a VM will be started.</span><br />
<pre>[pioro@piorovm ~]$ cd test
[pioro@piorovm test]$ vagrant init racattack
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[pioro@piorovm test]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Uploading base box image as volume into libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: test_default
==> default: -- Domain type: kvm
==> default: -- Cpus: 1
==> default: -- Memory: 512M
==> default: -- Base box: racattack
==> default: -- Storage pool: default
==> default: -- Image: /VM/d1/images/test_default.img
==> default: -- Volume Cache: default
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: 5900
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 9216
==> default: -- Keymap: en-us
==> default: -- Command line :
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if its present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Configuring and enabling network interfaces...
==> default: Rsyncing folder: /home/pioro/test/ => /vagrant
[pioro@piorovm test]$
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
There is a difference how files are synchronized between Vagrant and a VM machine in VirtualBox and other providers. Virtual Box is using a shared directory feature and KVM and EC2 are using rsync. Rsync process is started only once during VM start, and it to synchronize files after that “vagrant rsync” command has to be run</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Like I mentioned in previous post, there are differences in Vagrant configuration between hypervisors. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">The following example is showing a configuration which will add two disks:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> - 10 GB none shared disk and </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> - 20 GB disk which can be shared between hosts. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Memory size is set to 4 GB and number of vCPUs is set to 2. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">VM will have two network interfaces - one bridged to host network card (192.168.1.x) and one private KVM network (10.10.10.x)</span><br />
<br />
<pre>Vagrant.configure(2) do |config|
config.vm.box = "racattack "
config.vm.provider :libvirt do |libvirt|
libvirt.storage_pool_name = "pool_d1"
libvirt.memory=4096
libvirt.cpus=2
libvirt.storage :file, :size => '20G', :format => 'qcow2
libvirt.storage :file, :size => '10G', :type => 'raw', :allow_existing => 'true', :bus=> 'scsi', :device=>'sda', :path=>'asmdisk1_2'
end
config.vm.define :host do |host|
host.vm.hostname = "targetkvm"
host.vm.network :public_network, :dev => "br0", :mode => "bridge", :type => "bridge", :ip => "192.168.1.152"
host.vm.network :private_network, :libvirt__network_name => "private", :ip => "10.10.10.152"
end
end</pre>
<pre> </pre>
<pre> </pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
This is all about KVM for now but I believe this is a good starting point for experiments.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<b><span style="font-family: Arial,Helvetica,sans-serif;">EC2 configuration</span></b><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">AWS integration with Vagrnat is based on plugin as well. The main difference is that Vagrant box is limited to a file definition and VM is based on AMI delivered by AWS.<br />This AMI image can be official AWS build, community one or the one created by you.<br /><br />Installation of the additional plugin:</span><br />
<pre>$ vagrant plugin install vagrant-aws
Installing the 'vagrant-aws' plugin. This can take a few minutes...
Installed the plugin 'vagrant-aws (0.6.0)'!
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
List of all plugins</span>
<br />
<pre>$ vagrant plugin list
vagrant-aws (0.6.0)
vagrant-share (1.1.4, system)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Let's create a new directory and configure an EC2 container to start</span>
<br />
<pre>$ mkdir awstest
$ cd awstest/
$ vagrant init
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">In the next step a VM has to be configured. This is example Vagrantfile</span>
<br />
<pre>Vagrant.configure("2") do |config|
# for AWS use dummy box
config.vm.box = "dummy"
config.vm.provider :aws do |aws, override|
aws.access_key_id = "KEY_ID"
aws.secret_access_key = "SECRET_ACCESS_KEY"
aws.instance_type = "t1.micro"
aws.security_groups = "quick-start-1"
aws.keypair_name = "mykeys"
aws.region = "eu-west-1"
# this is official CentOS AMI
# agree to CentOS license - http://wiki.centos.org/Cloud/AWS
aws.ami = "ami-42718735"
override.ssh.username = "root"
override.ssh.private_key_path = "/tmp/mykey.pem"
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sdb1', 'Ebs.VolumeSize' => 50 }]
end
end
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Next step is easy "vagrant up" will start your EC2 instance</span>
<br />
<pre>$ vagrant up
Bringing machine 'default' up with 'aws' provider...
==> default: Warning! The AWS provider doesn't support any of the Vagrant
==> default: high-level network configurations (`config.vm.network`). They
==> default: will be silently ignored.
==> default: Launching an instance with the following settings...
==> default: -- Type: t1.micro
==> default: -- AMI: ami-42718735
==> default: -- Region: eu-west-1
==> default: -- Keypair: mykeys
==> default: -- Security Groups: ["quick-start-1"]
==> default: -- Block Device Mapping: [{"DeviceName"=>"/dev/sdb1", "Ebs.VolumeSize"=>50}]
==> default: -- Terminate On Shutdown: false
==> default: -- Monitoring: false
==> default: -- EBS optimized: false
==> default: -- Assigning a public IP address in a VPC: false
==> default: Waiting for instance to become "ready"...
==> default: Waiting for SSH to become available...
==> default: Machine is booted and ready for use!
==> default: Rsyncing folder: /tmp/awstest/ => /vagrant
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir -p '/vagrant'
Stdout from the command:
Stderr from the command:
sudo: sorry, you must have a tty to run sudo
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Instance is up and running. There was a problem with a rsync as there is problem with SUDO configuration in this AMI. It can be resolved but this is not an issue for this post. Let's try to ssh to EC2 VM now</span>
<br />
<pre>$ vagrant ssh
[root@ip-10-105-167-95 ~]# ls -l /dev/x*
brw-rw----. 1 root disk 202, 64 Sep 20 10:43 /dev/xvde
brw-rw----. 1 root disk 202, 81 Sep 20 10:43 /dev/xvdf1
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">SSH to EC2 with Vagrant is very simple. You don't need to remember that is a public IP of EC2 instance, "vagrant ssh" will do a trick. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">To stop EC2 instance use "vagrant halt" and to delete EC2 instance use "vagrant destroy"</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">This is all I would like to share in this post. In the next one, I will use Vagrant with VirtualBox and I will show how to add an automatic Oracle installation to your VM.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-44601809237420285162015-08-19T18:51:00.001+01:002015-09-23T10:02:41.902+01:00Automation for DBA - Vagrant part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><a href="https://www.vagrantup.com/">Vagrant</a> is an open source tool for building a virtual environment. It is based on text based configuration file and concept of prebuilt OS boxes. <br />One can find a lot of boxes on Atlas webpage (<a href="https://atlas.hashicorp.com/boxes/search">https://atlas.hashicorp.com/boxes/search</a>), ready to download and use. Although if there are any security concerns about using a OS from 3rd party webpage, I published a blog <a href="http://oracleprof.blogspot.ie/2015/08/preparing-oracle-linux-for-vagrant-box.html">post</a> about creating a new Vagrant box using Oracle Linux here and Oracle Virtual Box.<br /><br />For simplicity of this series, predefined Linux box will be used in all examples. <br />There are two boxes that I’m using in my own work.<br />First one “kikitux/oracle6-racattack” created by Alvaro Miranda (<a href="https://github.com/kikitux">https://github.com/kikitux</a>) member of Rac Attack team. The other one is “racattack/oracle65” created by Jeremy Schneider who is also member of RacAttack team.<br /><br />Vagrant itself is not a Virtualization provider. It can control different virtualization tools, including:<br />- Virtual Box<br />- AWS EC2 (with an additional plugin)<br />- KVM (with an additional plugin)<br />- VMWare Fusion / Workstation (paid version of Vagrant)<br /><br />Most of the differences between providers are hidden by Vagrant workflow, and a configuration file defining a Vagrant box is similar between different providers.<br />Vagrant user is using same set of commands to start, stop or destroy virtual machine and does not have to know which provider is used for that.<br /><br />There is a list of typical Vagrant commands:<br /><br />- vagrant init – creating a basic configuration file<br />- vagrant up – starting a virtual machine<br />- vagrant halt – stopping a virtual machine<br />- vagrant destroy – delete a virtual machine<br />- vagrant ssh – open a ssh session to vagrant user on virtual machine<br /><br />After this short introduction let’s get started with a Vagrant on Laptop/Desktop (using Virtual Box as a provider)<br /><br />Prerequisites:<br />- vagrant software – <a href="https://www.vagrantup.com/downloads.html">https://www.vagrantup.com/downloads.html</a><br />- Virtual Box - <a href="https://www.virtualbox.org/">https://www.virtualbox.org/</a><br /><br />In the first step a new directory will be created and used for Vagrant to initiate build of new virtual machine.</span><br />
<br />
<pre>mkdir machine1
cd machine1
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />In the next step Vagrant machine will be initialized</span><br />
<br />
<pre>vagrant init racattack/oracle65
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />A new Vagrantfile has been created with basic configuration. By default Vagrant is trying to change a default set of public / private key with a new pair generated on user machine. But there are some problem with that on latest version of Vagrant, so as a workaround please add this line to Vagrantfile (see <a href="https://github.com/mitchellh/vagrant/issues/5186">https://github.com/mitchellh/vagrant/issues/5186</a>)</span><br />
<br />
<pre>config.ssh.insert_key = false
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />This is how Vagrantfile looks like without commented lines</span><br />
<br />
<pre>Vagrant.configure(2) do |config|
config.vm.box = "racattack/oracle65"
config.ssh.insert_key = false
end
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Now this machine can be started. If a box selected in an init stage is not existing yet in the provider catalog, it will be automatically downloaded and cloned to a new machine.</span><br />
<br />
<pre>mprzepiorowski$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'racattack/oracle65' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'racattack/oracle65'
default: URL: https://atlas.hashicorp.com/racattack/oracle65
==> default: Adding box 'racattack/oracle65' (v14.11.01) for provider: virtualbox
default: Downloading: https://atlas.hashicorp.com/racattack/boxes/oracle65/versions/14.11.01/providers/virtualbox.box
==> default: Successfully added box 'racattack/oracle65' (v14.11.01) for 'virtualbox'!
==> default: Importing base box 'racattack/oracle65'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'racattack/oracle65' is up to date...
==> default: Setting the name of the VM: machine1_default_1439847872931_79029
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /vagrant => /Users/mprzepiorowski/Documents/machine1
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Is this that simple? Yes it is – a new virtual machine with Oracle Linux is installed and ready. Next step is to ssh into a new created machine. There is no need to know neither a password nor an IP address, </span><br />
<br />
<pre>mprzepiorowski$ vagrant ssh
[vagrant@oracle6-racattack ~]$
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />Now it is a time to customize this machine a little bit. Before that an existing machine has to be stopped using a Vagrant command</span><br />
<br />
<pre>mprzepiorowski$ vagrant halt
==> default: Attempting graceful shutdown of VM...
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />As it was mentioned at the beginning of the post, Vagrant is using a text based configuration file. All customizations can be done by editing this file.<br />The configuration file structure can be divided into two sections.<br />First section defines a provider configuration and this part will change when a provider will be changed. Other section is provider independent and describes all other parameters.</span><br />
<br />
<pre>Vagrant.configure(2) do |config|
# this part is common for all providers
config.vm.box = "racattack/oracle65"
config.ssh.insert_key = false
config.vm.hostname = "machine1"
# provider specific configuration
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
vb.cpus = 2
end
end
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />Starting a machine with a new configuration</span><br />
<br />
<pre>mprzepiorowski$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'racattack/oracle65' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Mounting shared folders...
default: /vagrant => /Users/mprzepiorowski/Documents/machine1
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />Checking changes</span><br />
<br />
<pre>[vagrant@machine1 ~]$ free
total used free shared buffers cached
Mem: 1020696 121356 899340 0 10980 42100
-/+ buffers/cache: 68276 952420
Swap: 8191996 0 8191996
[vagrant@machine1 ~]$ cat /proc/cpuinfo | grep processor
processor : 0
processor : 1
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">All looks good there. Virtual machine has 1 GB of RAM and two vCPU. Machine name has been changed to machine1 as well.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">The last change tested here will be a new disk assigned to virtual machine. The box used for an example already has a “sdb” device and an “u01” file system defined inside a box. In this case device “sdc” will be added to the box and can be configured later as a “u02” file system if necessary. The file system creation and configuration will be presented in the next posts about Ansible.</span><br />
<br />
<pre>disk_filename = 'disk-u02.vdi'
Vagrant.configure(2) do |config|
# this part is common for all providers
config.vm.box = "racattack/oracle65"
config.ssh.insert_key = false
config.vm.hostname = "machine1"
# provider specific configuration
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
vb.cpus = 2
unless File.exist?(disk_filename)
vb.customize ['createhd', '--filename', disk_filename, '--size', (5*1024), '--variant', 'Standard']
end
vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 2, '--device', 0, '--type', 'hdd', '--medium', disk_filename]
end
end
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Options specified in vb.customize are options of VBoxManage command of Virtual Box installation.</span><br />
<br />
<pre>mprzepiorowski$ vagrant ssh
Last login: Mon Aug 17 22:01:36 2015 from 10.0.2.2
[vagrant@machine1 ~]$ ls -l /dev/sdc*
brw-rw---- 1 root disk 8, 32 Aug 17 22:25 /dev/sdc
[vagrant@machine1 ~]$
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">New disk is added and ready for other activities.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">This is end of this post and I will present similar steps for KVM and EC2 virtual machines in the next one.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
<br />
<br />
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-23481226230979928012015-08-10T18:32:00.000+01:002015-08-10T18:32:01.040+01:00Preparing a Oracle Linux for a Vagrant box<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">This post is an overview of an installation and configuration process of the Oracle Linux, which will be used as a machine “box” for Vagrant software using a Virtual Box platform.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br />Post itself is divided into two parts:</span><br />
<ol style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">Oracle Linux installation (points 1 to 12)</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Vagrant box configuration (points 13 to 16)</span></li>
</ol>
<span style="font-family: Arial,Helvetica,sans-serif;"><b><span style="font-size: small;"><br />Part 1 – Oracle Linux installation </span></b><br /> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">1. Create a new Virtual Machine - machine name will be used later to create Vagrant box </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-oTeMhzNrbKo/VavkaN01wQI/AAAAAAAADPw/7Kn9rL_MKp4/s1600/vb1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://1.bp.blogspot.com/-oTeMhzNrbKo/VavkaN01wQI/AAAAAAAADPw/7Kn9rL_MKp4/s320/vb1.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">2. Set memory size - it does matter only for a installation process, as it can be changed later by Vagrant </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-fPdRCovQcXQ/VavkaQOwzQI/AAAAAAAADP0/dZRsSIfYusI/s1600/vb2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://1.bp.blogspot.com/-fPdRCovQcXQ/VavkaQOwzQI/AAAAAAAADP0/dZRsSIfYusI/s320/vb2.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">3. Create a new disk, which will be used to keep a root and a swap file systems only. Any additional disks will be added dynamically via Vagrant. In this example, a disk size is set to 8 GB.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-DP3cnshEeZc/Vavkaa5HG6I/AAAAAAAADP4/lT1wuYOqwSs/s1600/vb3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://2.bp.blogspot.com/-DP3cnshEeZc/Vavkaa5HG6I/AAAAAAAADP4/lT1wuYOqwSs/s320/vb3.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-iKuLKsLx9PI/Vavka--WuDI/AAAAAAAADP8/sNt_wYrqcO0/s1600/vb4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="206" src="http://3.bp.blogspot.com/-iKuLKsLx9PI/Vavka--WuDI/AAAAAAAADP8/sNt_wYrqcO0/s320/vb4.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-MqCwqKLILI0/Vavka5BqSKI/AAAAAAAADQA/f2MlxgJJ2o4/s1600/vb5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="206" src="http://1.bp.blogspot.com/-MqCwqKLILI0/Vavka5BqSKI/AAAAAAAADQA/f2MlxgJJ2o4/s320/vb5.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-b7oKvplB21E/VavkbP1X9XI/AAAAAAAADQk/SqfanQCyISQ/s1600/vb6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="206" src="http://4.bp.blogspot.com/-b7oKvplB21E/VavkbP1X9XI/AAAAAAAADQk/SqfanQCyISQ/s320/vb6.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">4.
Mount Oracle Linux DVD into Virtual Machine drive</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-TcdEx3rebkc/VavkbdyQPbI/AAAAAAAADQE/xJSI6Q0ICwQ/s1600/vb7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="http://2.bp.blogspot.com/-TcdEx3rebkc/VavkbdyQPbI/AAAAAAAADQE/xJSI6Q0ICwQ/s320/vb7.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">5. Configure 1st network interface to be NAT </span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-Se-GnsrNiMQ/VavkbsCzQTI/AAAAAAAADQM/o7H_n0znfQk/s1600/vb75.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="269" src="http://4.bp.blogspot.com/-Se-GnsrNiMQ/VavkbsCzQTI/AAAAAAAADQM/o7H_n0znfQk/s320/vb75.png" width="320" /></a><span style="font-family: Arial,Helvetica,sans-serif;"> </span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">6. Add port forwarding for SSH</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-FfOJq1Ux_eI/Vavmsbis5-I/AAAAAAAADQ8/fAoqv4VoDOw/s1600/vb77.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="http://1.bp.blogspot.com/-FfOJq1Ux_eI/Vavmsbis5-I/AAAAAAAADQ8/fAoqv4VoDOw/s320/vb77.png" width="320" /></a></div>
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">6.Start Virtual Machine and start a Oracle Linux installation. Some of the screens have been skipped in this post but a default values have been used for those ones.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/--PO-FT3-EFw/Vavm863qxwI/AAAAAAAADRk/LDctReqOZPY/s1600/vb8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="261" src="http://4.bp.blogspot.com/--PO-FT3-EFw/Vavm863qxwI/AAAAAAAADRk/LDctReqOZPY/s320/vb8.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">7.Choose language and keyboard</span> <br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-GTpEyzvKStY/Vavm62NwV7I/AAAAAAAADRM/1O-po7BuU1o/s1600/vb10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://3.bp.blogspot.com/-GTpEyzvKStY/Vavm62NwV7I/AAAAAAAADRM/1O-po7BuU1o/s320/vb10.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-jMyJ9Ex0N2M/Vavm7OMwBvI/AAAAAAAADRE/Kkwk_-xRIZ4/s1600/vb11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://3.bp.blogspot.com/-jMyJ9Ex0N2M/Vavm7OMwBvI/AAAAAAAADRE/Kkwk_-xRIZ4/s320/vb11.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-t4RhKdQEXY0/Vavm7Cpy1-I/AAAAAAAADRI/xrpFwX_6NTw/s1600/vb12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://2.bp.blogspot.com/-t4RhKdQEXY0/Vavm7Cpy1-I/AAAAAAAADRI/xrpFwX_6NTw/s320/vb12.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">8.Configure disk using a default basic definition</span></span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-uOOcLq9BVIU/Vavm7Y53p9I/AAAAAAAADRQ/u46BOzotgQA/s1600/vb13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://2.bp.blogspot.com/-uOOcLq9BVIU/Vavm7Y53p9I/AAAAAAAADRQ/u46BOzotgQA/s320/vb13.png" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Gmq3JtwCq30/Vavm7tnI1GI/AAAAAAAADRU/7H4cvmwSzec/s1600/vb14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://1.bp.blogspot.com/-Gmq3JtwCq30/Vavm7tnI1GI/AAAAAAAADRU/7H4cvmwSzec/s320/vb14.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">9.Configure a host name for a box, configure a network with DHCP and start up at boot time.</span></span></span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-VWVP3ojirfE/Vavm737Ah8I/AAAAAAAADRY/jtogY9IUmuE/s1600/vb15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://1.bp.blogspot.com/-VWVP3ojirfE/Vavm737Ah8I/AAAAAAAADRY/jtogY9IUmuE/s320/vb15.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">10.Default packages will be installed only at this time. Some will be added later.</span></span></span></span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-gusLUnLPb8o/Vavm8Mg8oMI/AAAAAAAADRc/BdQ5cfqpR70/s1600/vb16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://4.bp.blogspot.com/-gusLUnLPb8o/Vavm8Mg8oMI/AAAAAAAADRc/BdQ5cfqpR70/s320/vb16.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">11.Wait for process to be completed</span></span></span></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"> </span></span></span></span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-4NPguEHSwFU/Vavm8UGjTCI/AAAAAAAADSA/FzgCs-Fb-yE/s1600/vb17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://2.bp.blogspot.com/-4NPguEHSwFU/Vavm8UGjTCI/AAAAAAAADSA/FzgCs-Fb-yE/s320/vb17.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">12.Restart machine</span></span></span></span></span></span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-3cUl1YSTGQU/Vavm8Rc6X5I/AAAAAAAADRg/D_glVt7A4F8/s1600/vb18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://3.bp.blogspot.com/-3cUl1YSTGQU/Vavm8Rc6X5I/AAAAAAAADRg/D_glVt7A4F8/s320/vb18.png" width="320" /></a></div>
<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><b><span style="font-size: small;">Part 2 – Vagrant box configuration</span></b></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;"><span name="”point13”" style="font-family: Arial,Helvetica,sans-serif;">13. Add Vagrant related configuration</span></span></span></span></span></span><br />
<ul style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Add user "vagrant" with password "vagrant"</span></span></span></span></span></span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Add Vagrant public insecure public key to .authorized_keys</span></span></span></span></span></span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Install Guest additional tools </span></span></span></span></span></span></li>
</ul>
<span style="font-family: Arial,Helvetica,sans-serif;">Connect to VM using ssh</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span>
<br />
<pre>ssh -p 2022 root@localhost
The authenticity of host '[localhost]:2022 ([127.0.0.1]:2022)' can't be established.
RSA key fingerprint is 3e:4f:bd:ca:45:d6:e8:d4:6b:4d:02:bb:1f:c3:ad:a2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2022' (RSA) to the list of known hosts.
root@localhost's password:
Last login: Sat Jul 18 21:25:57 2015 from 10.0.2.2
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Add user using password vagrant</span>
<br />
<pre>[root@oelbox ~]# useradd vagrant
[root@oelbox ~]# passwd vagrant
Changing password for user vagrant.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Add Vagrant public key</span>
<br />
<pre>[root@oelbox ~]# su - vagrant
[vagrant@oelbox ~]$ mkdir .ssh
[vagrant@oelbox ~]$ chmod 700 .ssh
[vagrant@oelbox ~]$ cd .ssh
[vagrant@oelbox .ssh]$ wget --no-check-certificate https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O authorized_keys
--2015-07-18 21:29:16-- https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
Resolving raw.githubusercontent.com... 23.235.44.133
Connecting to raw.githubusercontent.com|23.235.44.133|:443... connected.
WARNING: certificate common name “www.github.com” doesn’t match requested host name “raw.githubusercontent.com”.
HTTP request sent, awaiting response... 200 OK
Length: 409 [text/plain]
Saving to: “authorized_keys”
100%[===========================================================================================================================================================>] 409 --.-K/s in 0s
2015-07-18 21:29:17 (94.1 MB/s) - “authorized_keys” saved [409/409]
[vagrant@oelbox .ssh]$ chmod 600 authorized_keys
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Choose Install Guest Additional CD from Virtual Box menu and check if CDROM it was mounted</span></span></span></span></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-SvP8RR0SjL0/VavkcIRTyiI/AAAAAAAADQg/P9VO5XVsKgM/s1600/vb76.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="http://4.bp.blogspot.com/-SvP8RR0SjL0/VavkcIRTyiI/AAAAAAAADQg/P9VO5XVsKgM/s320/vb76.png" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Install required packages and add Guest tools</span></span></span></span></span></span><br />
<pre>[root@oelbox ~]# yum install kernel-uek-devel-3.8.13-16.2.1.el6uek.x86_64
[root@oelbox ~]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@oelbox ~]# /mnt/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.20 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.20 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules [ OK ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module [ OK ]
Building the shared folder support module [ OK ]
Building the OpenGL support module [ OK ]
Doing non-kernel setup of the Guest Additions [ OK ]
Starting the VirtualBox Guest Additions [ OK ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping. </pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">14. Install packages required for Oracle database and EPEL repository and Ansible. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">If you are using RedHat or Centos you can’t use oracle-rdbms packages. Oracle-ansible playbook, which will be used later will take care about all packages during a first installation. </span><br />
<br />
<pre>[root@oelbox ~]# yum install oracle-rdbms-server-11gR2-preinstall.x86_64 oracle-rdbms-server-12cR1-preinstall.x86_64
[root@oelbox ~]# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.SCcj3K: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
[root@oelbox ~]# yum install ansible
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">15. Configure sudo for vagrant user - disable requiretty and allow vagrant user to run sudo without password for all commands.</span><br />
<pre>[root@oelbox ~]# visudo
#Defaults requiretty
vagrant ALL=(ALL) NOPASSWD: ALL
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">16. Shutdown Virtual Machine.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">This is end of configuration on the Linux level and this Virtual Machine can be used now as a source of the Vagrant box.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-67618723231200491842015-07-20T16:31:00.001+01:002015-07-21T09:09:51.685+01:00How to avoid boring work<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Over the past few years working as an IT consultant, I've learned that having easy access to a robust lab where I can learn or test solutions is critical. But my approach to building a test lab has changed over the years.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">These days I prefer not to "build" a lab but to "define" one — it is a better use of my time.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Building requires a long step-by-step process of installing all the necessary components: OS, databases, app servers, one by one based on the documentation. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Instead, I can define a lab using tools such as Ansible, Chef, Puppet, Oracle Enterprise Manager, on top of tools that manage Virtual Machines like Vagrant or libvirt.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">I presented my thoughts during Irish Oracle User Group conference in March 2015 ( <a href="http://www.slideshare.net/MarcinPrzepirowski/avoid-boring-workv2">How to avoid boring work</a> ) </span><span style="font-family: Arial,Helvetica,sans-serif;">and now I would like to start a series of blog post about this.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><iframe allowfullscreen="" frameborder="0" height="355" marginheight="0" marginwidth="0" scrolling="no" src="//www.slideshare.net/slideshow/embed_code/key/BhJcapaByoeUZV" style="border-width: 1px; border: 1px solid #CCC; margin-bottom: 5px; max-width: 100%;" width="425"> </iframe></span> <br />
<div style="margin-bottom: 5px;">
<span style="font-family: Arial,Helvetica,sans-serif;"><b> <a href="https://www.slideshare.net/MarcinPrzepirowski/avoid-boring-workv2" target="_blank" title="Avoid boring work_v2">Avoid boring work_v2</a> </b> from <b><a href="https://www.slideshare.net/MarcinPrzepirowski" target="_blank">Marcin Przepiórowski</a></b></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><b> </b></span> </div>
<span style="font-family: Arial,Helvetica,sans-serif;">Here is a list of topics I plan to cover in the next few weeks:</span><span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<ul style="text-align: left;">
<li>
<span style="font-family: Arial,Helvetica,sans-serif;">Creating and managing a Virtual Machine using <a href="https://www.vagrantup.com/">Vagrant</a> (create a new box, add storage, use KVM or AWS EC2 as providers )<br /> </span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Installing and configuring Oracle Database using <a href="http://www.ansible.com/home">Ansible</a> ( Thanks to great work of Mikael Sandström on his <a href="https://github.com/oravirt/ansible-oracle">Github Ansible repository</a> )</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Integration of <a href="http://www.delphix.com/">Delphix</a> "Data as a Service" product with an automated test environment build</span></li>
</ul>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com2tag:blogger.com,1999:blog-7461233846321640962.post-82502479612907259772014-12-22T20:12:00.000+00:002014-12-22T20:12:32.005+00:00Data Guard and Oracle Restart, aka relink always !!!<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">During my early years with PC I love to play "Leisure Suit Larry" (especially part 1 to 3 which has running on CGA or Hercules graphics card). Author of this games, <a href="http://en.wikipedia.org/wiki/Al_Lowe">Al Lowe</a> had a good sense of humor and every time you failed your mission or stuck in a place - there was an pop up on the screen "Al says: save early, save often". After today fight with Oracle I should remember a next saying - "Relink after, relink always".</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Let me explain what what happen today.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">There used to be old Oracle bug in 11.2g which I described <a href="http://oracleprof.blogspot.ie/2012/08/dataguard-and-oracle-restart-how-to.html">here</a>. Basically Oracle Restart was not aware of role changes and could open a database in wrong mode after role switch. I created a workaround for it but I was really waiting for a patch. During a UKOUG 2014 I was speaking with Oracle Data Guard Product Manager - Larry Carpenter - and I learned that patch is ready. I asked <a href="https://twitter.com/UweHesse">@UweHesse</a> for details and I got my numbers back - patch 15986647 and it is included in latest PSU 11.2.0.4.4.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">After I got this information I was happy - I just applied this PSU last week, so let's test it.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">The first run looked OK - after switchover Oracle Restart displayed proper role and start-up option on new primary
</span><br />
<pre><span style="font-family: Arial,Helvetica,sans-serif;">agent/ohasd/oraagent_grid/oraagent_grid.log
2014-12-22 09:02:36.511: [ AGFW][2057]{0:0:44372} Agent received the message: RESOURCE_MODIFY_ATTR[ora.apppre11.db 1 1] ID 4355:617901
2014-12-22 09:02:36.513: [ora.apppre11.db][9207]{0:0:44372} [res_attr_modified] clsn_agent::modify {
2014-12-22 09:02:36.513: [ora.apppre11.db][9207]{0:0:44372} [res_attr_modified] clsn_agent::modify }
2014-12-22 09:02:36.513: [ AGFW][9207]{0:0:44372} Command: res_attr_modified for resource: ora.apppre11.db 1 1 completed with status: SUCCESS
2014-12-22 09:02:36.516: [ AGFW][2057]{0:0:44372} Attribute: ROLE for resource ora.apppre11.db modified to: PRIMARY
2014-12-22 09:02:36.516: [ AGFW][2057]{0:0:44372} Attribute: USR_ORA_OPEN_MODE for resource ora.apppre11.db modified to: open
2014-12-22 09:02:36.516: [ AGFW][2057]{0:0:44372} config version updated to : 69 for ora.apppre11.db 1 1
2014-12-22 09:02:36.516: [ AGFW][2057]{0:0:44372} Agent sending last reply for: RESOURCE_MODIFY_ATTR[ora.apppre11.db 1 1] ID 4355:617901
2014-12-22 09:02:36.663: [ AGFW][2057]{0:0:44374} Agent received the message: RESOURCE_MODIFY_ATTR[ora.apppre11.apppre_adf.svc 1 1] ID 4355:617914
</span></pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;">
but only proper role on the new standby.
</span>
</span><br />
<pre><span style="font-family: Arial,Helvetica,sans-serif;">agent/ohasd/oraagent_grid/oraagent_grid.log
2014-12-22 09:03:10.420: [ AGFW][2057]{0:0:11369} Agent received the message: RESOURCE_MODIFY_ATTR[ora.apppre21.db 1 1] ID 4355:189787
2014-12-22 09:03:10.423: [ora.apppre21.db][2412]{0:0:11369} [res_attr_modified] clsn_agent::modify {
2014-12-22 09:03:10.424: [ora.apppre21.db][2412]{0:0:11369} [res_attr_modified] clsn_agent::modify }
2014-12-22 09:03:10.424: [ AGFW][2412]{0:0:11369} Command: res_attr_modified for resource: ora.apppre21.db 1 1 completed with status: SUCCESS
2014-12-22 09:03:10.424: [ AGFW][2057]{0:0:11369} Attribute: ROLE for resource ora.apppre21.db modified to: PHYSICAL_STANDBY
2014-12-22 09:03:10.424: [ AGFW][2057]{0:0:11369} config version updated to : 142 for ora.apppre21.db 1 1
2014-12-22 09:03:10.424: [ AGFW][2057]{0:0:11369} Agent sending last reply for: RESOURCE_MODIFY_ATTR[ora.apppre21.db 1 1] ID 4355:189787
</span></pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;">
Start up option was still open instead of mount. Hmmm, I was sure that both nodes are same but again I reconfigure Data Guard Broker and Oracle Restart - no change - issue was resolved on the one server only. Then I decided to double check if I have this PSU installed, and I found out that </span><span style="font-family: Arial,Helvetica,sans-serif;">everything was in order in terms of PSU. </span><br />
<pre>-bash-3.2$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-12-22_15-08-59PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2014-12-22_15-08-59PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.4.0
There are 1 product(s) installed in this Oracle Home.
Interim patches (3) :
Patch 18235390 : applied on Mon Dec 22 14:54:02 GMT 2014
Unique Patch ID: 18349043
Created on 4 Dec 2014, 18:50:09 hrs PST8PDT
Bugs fixed:
18235390
Patch 19121549 : applied on Mon Nov 17 14:06:54 GMT 2014
Unique Patch ID: 18060349
Patch description: "OCW Patch Set Update : 11.2.0.4.4 (19121549)"
Created on 7 Oct 2014, 03:38:04 hrs PST8PDT
Bugs fixed:
18328800, 18691572, 14525998, 18187697, 18348155, 17516024, 17387214
17750548, 17617807, 17551223, 14671408, 14207615, 18272135, 18180541
17292250, 17378618, 17500165, 18875012, 18464784, 17065496, 18848125
13991403, 17955615, 14693336, 17273020, 17238586, 17089344, 17405605
17531342, 17155238, 17159489, 18053580, 16543190, 17039197, 16317771
17947785, 10052729, 16281493, 18346135, 17481314, 18199185, 18399991
18024089, 18428146, 18352845, 18352846, 17391726, 18414137, 17001914
17927970, 14378120, 16346413, 17305100, 15832129, 15986647, 16901346
18068871, 17985714, 18536826, 16206997, 18752378, 16876500, 16429265
18343490, 18336452, 16613232, 17273003, 19276791, 12928658, 18226143
17172091, 18229842, 18053631, 16867761, 18231837, 15869775, 17483479
18729166, 17405302, 15920201, 18709496
Patch 19121551 : applied on Mon Nov 17 14:05:34 GMT 2014
Unique Patch ID: 17971200
Patch description: "Database Patch Set Update : 11.2.0.4.4 (19121551)"
Created on 9 Oct 2014, 13:06:55 hrs PST8PDT
Sub-patch 18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)"
Sub-patch 18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)"
Sub-patch 17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
Bugs fixed:
16929165, 16220077, 17235750, 17468141, 18191164, 17006183, 16315398
17501491, 13955826, 17288409, 12905058, 17446237, 17375354, 16992075
16855292, 17050888, 17546973, 18554871, 17726838, 17614134, 9756271
18673325, 17227277, 17232014, 13853126, 17545847, 17390160, 18096714
12747740, 17016369, 17786518, 19271443, 10136473, 16785708, 17311728
18018515, 16268425, 17610798, 18280813, 17082359, 17783588, 14245531
18094246, 13866822, 17477958, 16943711, 18673304, 18031668, 19463897
19463893, 19211724, 13498382, 16450169, 17397545, 17786278, 17767676
14458214, 19289642, 17622427, 17824637, 17716305, 16399083, 18744139
14852021, 19727057, 17242746, 17174582, 18277454, 13645875, 14084247
17551709, 17393683, 17614227, 17705023, 17883081, 16042673, 18996843
16285691, 17393915, 16228604, 17655634, 17596908, 17600719, 16180763
17754782, 17323222, 18264060, 17325413, 17343514, 17865671, 16613964
17811447, 16069901, 17390431, 16494615, 16043574, 17006570, 17027426
14602788, 17080436, 18673342, 17186905, 17011832, 17394950, 13944971
17752121, 17284817, 17811456, 17238511, 17239687, 17042658, 14764829
17602269, 17672719, 17891946, 17205719, 18262334, 16721594, 17071721
14565184, 17265217, 17389192, 17761775, 16360112, 17982555, 17842825
19121551, 16837842, 18139690, 17313525, 18203837, 18203838, 18203835
18436307, 17546761, 17721717, 17344412, 17787259, 16472716, 17346671
17588480, 13364795, 14657740, 11733603, 17811438, 19466309, 17040527
17037130, 17088068, 17612828, 18180390, 17449815, 19458377, 19554106
18973907, 18230522, 19544839, 17811429, 16863422, 17237521, 17951233
17752995, 16392068, 17437634, 14338435, 13609098, 17332800, 18199537
17465741, 17441661, 18522509, 18061914, 14133975, 17570240, 16692232
18247991, 18328509, 16956380, 17587063, 19049453, 16618694, 17586955
18009564, 14285317, 16542886, 17341326, 17571306, 17036973, 18641419
16524926, 17297939, 17478145, 17040764, 17299889, 16912439, 15861775
14054676, 13951456, 17267114, 16850630, 17648596, 14010183, 17296856
17478514, 16875449, 18681862, 14829250, 17385178, 17443671, 16731148
16314254, 17165204, 15979965, 19584068, 17381384, 17892268, 16198143
--------------------------------------------------------------------------------
OPatch succeeded.</pre>
<pre> </pre>
</span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">But on one server I was testing patch
for OEM (18235390) to allow it to monitor tablespaces without ORA-1000
errors.Is it possible that my OEM patch add anything special ?</span></span> </span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">I was thinking about that for a while but I was not sure. So I did simple test - installed this patch on standby server and ... yes - Oracle Restart issue has been fixed. </span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"> </span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Strange, very strange - what this patch did that Data Guard was fixed ? Well it did one important thing - it relinked oracle binaries again.</span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"> </span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Lucky enough I got one more pair with latest PSU ready for test.I run test with PSU installed and bug was still there. OK - so let's relink - and it was it<br />
</span><br />
<pre><span style="font-family: Arial,Helvetica,sans-serif;">2014-12-22 14:33:40.942: [ AGFW][2057]{0:0:12827} Agent received the message: RESOURCE_MODIFY_ATTR[ora.apppre21.db 1 1] ID 4355:199223
2014-12-22 14:33:40.944: [ora.apppre21.db][9494]{0:0:12827} [res_attr_modified] clsn_agent::modify {
2014-12-22 14:33:40.945: [ora.apppre21.db][9494]{0:0:12827} [res_attr_modified] clsn_agent::modify }
2014-12-22 14:33:40.945: [ AGFW][9494]{0:0:12827} Command: res_attr_modified for resource: ora.apppre21.db 1 1 completed with status: SUCCESS
2014-12-22 14:33:40.946: [ AGFW][2057]{0:0:12827} Attribute: ROLE for resource ora.apppre21.db modified to: PHYSICAL_STANDBY
2014-12-22 14:33:40.946: [ AGFW][2057]{0:0:12827} Attribute: USR_ORA_OPEN_MODE for resource ora.apppre21.db modified to: mount
2014-12-22 14:33:40.946: [ AGFW][2057]{0:0:12827} config version updated to : 153 for ora.apppre21.db 1 1
2014-12-22 14:33:40.946: [ AGFW][2057]{0:0:12827} Agent sending last reply for: RESOURCE_MODIFY_ATTR[ora.apppre21.db 1 1] ID 4355:199223
</span></pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;"> </span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">This is quite strange and a little bit scary. I have installed all PSU using opatch auto from Grid Infrastructure Home and there was no errors but relinking Oracle Home actually fix a problem which was included in the patch. </span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"> </span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">So remember "Relink after (patch), relink always"</span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"> </span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">regards,</span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span></span></div>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-71342523064994717122014-08-24T18:51:00.000+01:002014-08-24T18:51:48.312+01:00AWR Warehouse<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">I just noticed last week that there is a new patch for Enterprise Manager and it is enabling AWR Warehouse feature. There is a note ID 1901202.1 which describe bundle patch for OEM 12c release 4.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Today I had a chance to install it in my lab and now I can start testing new OEM feature.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">There is some documentation <a href="http://docs.oracle.com/database/121/TDPPT/tdppt_awr_warehouse.htm#TDPPT145">here</a> and on Kellyn's <a href="http://dbakevlar.com/">blog</a>. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-zHVQQlDFkFg/U_og_loFqkI/AAAAAAAABcA/hzx_G-u-Kv8/s1600/1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-zHVQQlDFkFg/U_og_loFqkI/AAAAAAAABcA/hzx_G-u-Kv8/s1600/1.PNG" height="304" width="640" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">It is not configured so first task is to configure AWR Warehouse repository. In my case I will use same database which is used for OEM repository.</span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-RB6vn28c1i8/U_ohAumnCFI/AAAAAAAABa0/3OMjeCSjxp8/s1600/2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-RB6vn28c1i8/U_ohAumnCFI/AAAAAAAABa0/3OMjeCSjxp8/s1600/2.PNG" height="316" width="400" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Retention period and staging area for snapshot files has to be configured as well.</span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/--X8CibCn_yQ/U_ohA2KHz5I/AAAAAAAABa4/M-R3ztJIPVA/s1600/3.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/--X8CibCn_yQ/U_ohA2KHz5I/AAAAAAAABa4/M-R3ztJIPVA/s1600/3.PNG" height="316" width="400" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">After these two steps AWR Warehouse configuration job is started and when it will be finished AWR Warehouse will be ready to use.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-gz_J9k7IIMc/U_ohBOwm6pI/AAAAAAAABbQ/Ty1ckdJiYQc/s1600/4.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-gz_J9k7IIMc/U_ohBOwm6pI/AAAAAAAABbQ/Ty1ckdJiYQc/s1600/4.PNG" height="307" width="640" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">When repository is ready we can start adding databases which will be a source of AWR data.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span> <br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-3Js69Z4M0rU/U_ohBasl-qI/AAAAAAAABbA/FvsEa9JtZiY/s1600/5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-3Js69Z4M0rU/U_ohBasl-qI/AAAAAAAABbA/FvsEa9JtZiY/s1600/5.PNG" height="306" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;">To add a new database to warehouse it has be already configured in OEM and has a default credentials.</span></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-7HC3CY5K7vc/U_ohCe9J6EI/AAAAAAAABbU/kNI7kuGSXqU/s1600/7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-7HC3CY5K7vc/U_ohCe9J6EI/AAAAAAAABbU/kNI7kuGSXqU/s1600/7.PNG" height="367" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="font-family: Arial,Helvetica,sans-serif;">If all conditions are met database has been successfully added.</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-yzABYUekFog/U_og_vw7KpI/AAAAAAAABas/m7Jmgx9maQI/s1600/10.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-yzABYUekFog/U_og_vw7KpI/AAAAAAAABas/m7Jmgx9maQI/s1600/10.PNG" height="306" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;">Now it's time to play with these new feature and see what we can achieve using it.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span></div>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-1126796309260103102014-08-24T12:05:00.000+01:002014-08-24T12:07:45.405+01:00Crossplatform transportable tablespaces - part 2<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">It took some time since I wrote a first post about TTS migration but I finished that project literally hours before my summer break. Now after couple of days while I enjoyed thermal waters and <a href="http://villanyiborvidek.hu/">good wine</a> of Hungary it's time to write next post.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">As I described in my <a href="http://oracleprof.blogspot.ie/2014/07/crossplatform-transportable-tablespaces.html">previous post</a> I had to migrate database from HP-UX into Linux and also upgrade it from 10g into 12c. This time it was only PoC but my goal was to minimize downtime of production database. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Source database datasheet:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- version 10.2.0.4 </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- OS - HP-UX </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- existing backup using data files copy </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- there is a one backup set per data file </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- daily incremental backups are recovered into data files and keep in FRA</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br />On target server a new version of Oracle 12.1.0.1 has been installed and configured with ASM. New database with same character set as source database has been created as well.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Target database datasheet:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- version 12.1.0.1 </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- OS -Linux 64 bit</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">- storage - ASM</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Transportable tablespaces (TTS) allow us to migrate data between databases but it is DBA responsibility to migrate rest of objects like views and PL/SQL code using for example DataPump. Before I have started a work on TTS I did the following preparation steps:</span><br />
<ol style="font-family: Arial,Helvetica,sans-serif;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">On source database identify list of tablespaces and it's datafiles to move to new server </span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">On source database identify owners of objects included in TTS</span>
<pre>select distinct owner from dba_tables where tablespace_name like ('LIST','OF','TABLESPACES','TO','MIGRATE');
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">On source database verify that tablespaces are self contained</span>
<pre>begin
SYS.DBMS_TTS.TRANSPORT_SET_CHECK(ts_list => 'LIST,OF,TABLESPACES,TO,MIGRATE', full_check => TRUE);
end;
/
select * from SYS.TRANSPORT_SET_VIOLATIONS;
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">On target database create owners for all objects included in TTS </span></li>
</ol>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">This is list of steps I performed to achieve my goal.</span><br />
<ol style="font-family: Arial,Helvetica,sans-serif;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">Copy existing data files copies into new server - if other location is used on new server change script in point 2</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Create a script to convert data file from data file copy into data file in new location </span>
<pre class="brush:sql">select 'convert datafile ''' || b.name || ''' format ''+DATA/POCDB/TTS/' || REGEXP_REPLACE(f.name,'(/disk\d/oradata/XXX/)','') || ''' from platform ''HP-UX IA (64-bit)'';' from V$BACKUP_COPY_DETAILS b, v$datafile f where f.file# = b.file#;
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Convert file using script from point 2. Example output</span>
<pre class="brush:sql">convert datafile '/oracle/fra/o1_mf_pocdb_rep_9x3xjcon_.dbf' format '+DATA/POCDB/TTS/reports01.dbf' from platform 'HP-UX IA (64-bit)';
convert datafile '/oracle/fra/o1_mf_pocdb_rep_aas24412_.dbf' format '+DATA/POCDB/TTS/reports02.dbf' from platform 'HP-UX IA (64-bit)';
convert datafile '/oracle/fra/o1_mf_pocdb_rep_22ee1445_.dbf' format '+DATA/POCDB/TTS/reports03.dbf' from platform 'HP-UX IA (64-bit)';
convert datafile '/oracle/fra/o1_mf_pocdb_rep_34ddr545_.dbf' format '+DATA/POCDB/TTS/reports04.dbf' from platform 'HP-UX IA (64-bit)';
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Copy daily incremental backupsets into new server </span><span style="font-family: Arial,Helvetica,sans-serif;">- if other location is used on new server change script in point 5</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Create a script to apply incremental backupset into new files</span>
<pre class="brush:sql">set linesize 600 pagesize 999 feedback off head off trimspool on
select 'recover from platform ''HP-UX IA (64-bit)'' foreign datafilecopy ''' || name || ''' from backupset ''' || handle || ''';'
from V$BACKUP_DATAFILE bd, v$datafile d, V$BACKUP_PIECE bp where bd.file# = d.file#
and bp.set_count = bd.set_count and handle is not null
and bp.COMPLETION_TIME > sysdate -1
order by bp.set_count;
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Recover data files copies</span>
<pre class="brush:sql">recover from platform 'HP-UX IA (64-bit)' foreign datafilecopy '+DATA/POCDB/TTS/reports01.dbf' from backupset '/oracle/fra/POCDB/backupset/2014_07_20/o1_mf_nnnd1_TAG20140720T065649_9wppkp6w_.bkp';
recover from platform 'HP-UX IA (64-bit)' foreign datafilecopy '+DATA/POCDB/TTS/reports02.dbf' from backupset '/oracle/fra/POCDB/backupset/2014_07_20/o1_mf_nnnd1_TAG20140720T065649_9wppkxg5_.bkp';
recover from platform 'HP-UX IA (64-bit)' foreign datafilecopy '+DATA/POCDB/TTS/reports03.dbf' from backupset '/oracle/fra/POCDB/backupset/2014_07_20/o1_mf_nnnd1_TAG20140720T065649_9wppk4w9_.bkp';
recover from platform 'HP-UX IA (64-bit)' foreign datafilecopy '+DATA/POCDB/TTS/reports04.dbf' from backupset '/oracle/fra/POCDB/backupset/2014_07_20/o1_mf_nnnd1_TAG20140720T065649_9wppkbws_.bkp';
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Run steps 4 to 6 until cut over date </span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Run incremental backup on source</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Switch all required tablespace into read only mode</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Export transportable tablespaces using DataPump
using parameter file like this</span>
<pre>directory=XXX_DPDUMP
dumpfile=tts_aws1.dmp
logfile=tts.log
TRANSPORT_TABLESPACES='TABLESPACES', 'TO', 'EXPORT'
TRANSPORT_FULL_CHECK=y
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">EXPDP command</span>
<pre>expdp parfile=tts.par
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Run incremental backup on source</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Copy backupsets from point 8 and 11 into new server</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Create a script to apply incremental backupset into new files (like in point 5)</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Import transportable tablespaces using dump file from point 9 and all converted files. In my case first attempt took very long as I didn't excluded stats and Oracle was gathering stats during importing process. This operation can be postponed to next phase using EXCLUDE option. Example IMPDP parameter file</span>
<pre>directory=AWS
dumpfile=tts_aws1.dmp
logfile=aws_tts_import1.log
exclude=TABLE_STATISTICS,INDEX_STATISTICS
TRANSPORT_DATAFILES=+DATA/POCDB/TTS/reports01.dbf,
+DATA/POCDB/TTS/reports02.dbf,
+DATA/POCDB/TTS/reports03.dbf,
+DATA/POCDB/TTS/reports04.dbf
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Run IMPDP command</span>
<pre>impdp parfile=imp.par
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Export source database code and users</span>
<pre>expdp directory=DPDUMP dumpfile=code.dmp exclude=TABLE_DATA full=y
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Import PL/SQL code - quick, dirty approach - but it was enough fot that case</span>
<pre>impdp directory=AWS TABLE_EXISTS_ACTION=SKIP dumpfile=code.dmp log=code_import.log full=y
</pre>
</li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Perform backup of new database and gather new statistics</span>
</li>
</ol>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"></span><span style="font-family: Arial,Helvetica,sans-serif;"></span><span style="font-family: Arial,Helvetica,sans-serif;"> </span>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Performing all steps above allow me to migrate 1 TB database from HP-UX into Linux with 30 min downtime on source database. As it was POC I left source database working as main production database. For real migration time it's necessary to add time to recover last incremental backup and import TTS on new platform and also resolve issue with time necessary to gather statistics on new platform. Probably copy existing stats using PL/SQL will be solution there but it has to be check in next phase.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">This post is long enough so I leave lesson learned to the next one.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
<br />
<br />
<br /></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-3155419073517029552014-07-26T14:11:00.000+01:002014-07-26T14:11:46.918+01:00Beauty of command line - OEM 12c<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Why all software should have a command line and automation plugin ? Answer is simple - if you have to repeat number of operation for different targets - scripts can help you save your precious time.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">I really enjoy a fact that Oracle added a command line to Oracle Enterprise Manager line, and now you can script lot of boring tasks like adding new administrator to list of users who can access Named Credentials.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">To add new admin (przepiorom) it's enough to run the following script</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span><br />
<pre>add_privs.sh przepiorom
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">This is first draft of this script (no error handling but it's doing his work)</span><br />
<pre>#!bin/bash
NEW_ADMIN=$1
TPID=$$
PRIV_LIST=`emcli list_named_credentials | awk '{ print $1; }' | grep -v Credential > /tmp/priv_$TPID`
while read LINE ; do
echo $LINE
emcli grant_privs -name="${NEW_ADMIN}" -privilege="FULL_CREDENTIAL;CRED_NAME=${LINE}:CRED_OWNER=sysman"
done > /tmp/priv_$TPID
rm /tmp/priv_$PPID
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">The next example is an another script which is refreshing a Weblogic domain components.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">When a new version of application is deployed a previous one are still registered as a targets and you will see it as down in your OEM.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-slmEZIauonc/U9Ofd9VjCmI/AAAAAAAABaA/cEsh_-bxMhs/s1600/down_apps.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-slmEZIauonc/U9Ofd9VjCmI/AAAAAAAABaA/cEsh_-bxMhs/s1600/down_apps.png" height="153" width="640" /></a></div>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">There is a domain refresh command in OEM menu but if you have more systems going through all of those is not what you want. Using a command line and configuration file you can be done with one line.</span><br />
<pre>emcli login -username=sysman -password=xxxxxxx -force
emcli refresh_wls -input_file=domain_refresh_file:/home/oracle/bin/domain_refresh_file.csv –debug
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />Content of domain_refresh_file.csv looks like this:</span>
<br />
<pre>/xxx_soa_mot_domain_soa/soa,R
/xxx_soa_mot_domain_soa/soa,E
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br />There is a one line per target split into two parts. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">First part of line is a target name and domain name, ex. /xxx_soa_mot_domain_soa/soa
Second part is operation: </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">R - remove target which doesn't exist in domain anymore </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">E - enable refresh of domain (aka. add monitoring targets)</span><span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-28424371844091566912014-07-16T21:13:00.000+01:002014-07-16T21:13:05.173+01:00Crossplatform transportable tablespaces - part 1<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">There is couple of way to do heterogeneous migration of Oracle databases but staring with 12c there is whole set of new <a href="http://docs.oracle.com/cd/E16655_01/backup.121/e17630/rcmxplat.htm#BRADV05432">RMAN commands</a> to transport data across different platforms.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">I was looking for a best method of move tablespaces from HP-UX to Linux and after some research I found this <a href="http://assets.red-gate.com/products/oracle-development/education/webinars/assets/martin-bach-reducing-downtime-incremental-backups-x-platform-tts-webinar.pdf">presentation </a>by Martin Bach from Enkitec (you can watch it online <a href="https://www.youtube.com/watch?v=4WOFjEDtLW8">here</a>). Martin describing Oracle Perl script (MOS ID </span><span style="font-family: Arial,Helvetica,sans-serif;">1389592.1) which allows you to convert tablespaces on 11g database including Exadata. At first sigh it looks like a solution for me but to use that script I need to create a new backup of all tablespaces I want to move. That could be an option but I already had a daily updated copy of all data files in FRA. So in next step I started to investigate who script is working and how to convert a backupset from HPUX to Linux and apply incremental backup into files not registered into database. Well solution was easy to predict - use PL/SQL RMAN interface - DBMS_BACKUP_RECOVERY package. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">It was not a first time when I was looking into it and it remembered me a Oracle 8i database with corrupted control file without RMAN catalog which had to be recovered. For those who forget RMAN in Oracle 8i had not a catalog functionality so you had to treat all control files or RMAN catalog with extra care. But using knowledge about files and backup names, PL/SQL and DBMS_BACKUP_RECOVERY it was possible to restore everything manually. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">But let's come back to current problem - I was keen to use PL/SQL but before that I decided to check what new Oracle introduced in 12c and nice surprise - now all operations described used by Oracle perl script are possible from RMAN interface. So in next step I decided to do a little test with existing copies of data files from smallest tablespace called 'USERS'.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">This small test was successful and now I need to document and describe all steps and this is material for a next post. It's working a little bit better than Oracle script as </span><span style="font-family: Arial,Helvetica,sans-serif;">there is no need to convert backupset - recover can apply and do conversion on the fly</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">New syntax to learn in investigate more:</span><br />
<pre>RMAN> recover from platform 'HP-UX IA (64-bit)' foreign datafilecopy 'C:\TEMP\USERS01.DBF' from backupset 'c:\temp\inc15_2.bkp';
Starting restore at 15-JUL-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring foreign file C:\TEMP\USERS01.DBF
channel ORA_DISK_1: reading from backup piece c:\temp\inc15_2.bkp
channel ORA_DISK_1: foreign piece handle=C:\TEMP\INC15_2.BKP
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 15-JUL-14
</pre>
<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-7659137809705574432014-07-01T23:18:00.002+01:002014-07-01T23:18:37.740+01:00Don't delete your flashback logs manually <div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">What happen when someone will delete Oracle flashback logs ? You probably don't notice it until you will try to flashback database or bounce instance. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">There is no hope for flashback database without flashback files but there is still way to start your database again without recovery or data loss.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Here is a scenario:</span><br />
<pre class="brush:sql">[oracle@dev-6 alert]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jul 1 09:34:18 2014
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 option
SQL> select status from v$instance;
STATUS
------------------------------------------------
MOUNTED
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-38760: This database instance failed to turn on flashback database
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
OK open database doesn't work. So what happen when I disable a flashback logging
</span>
<br />
<pre class="brush:sql">SQL> alter database flashback off;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-38760: This database instance failed to turn on flashback database
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
Well still doesn't work - but what is a flashback state ?
</span>
<br />
<pre class="brush:sql">SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------------------------------------------------------------
RESTORE POINT ONLY
SQL> select * from v$restore_point;
select * from v$restore_point
*
ERROR at line 1:
ORA-38701: Flashback database log 33 seq 476 thread 1:
"/u01/app/oracle/fast_recovery_area/DEV/flashback/o1_mf_9nq1wbon_.flb"
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
OK at least there is some information about root cause - it is looking for missing flashback files.
Information about flashback database is keep inside control file so let's try to recreate control file using trace file
</span>
<br />
<pre class="brush:sql">SQL> alter database backup controlfile to trace as '/tmp/control.ctl';
Database altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1336176640 bytes
Fixed Size 2253024 bytes
Variable Size 822087456 bytes
Database Buffers 503316480 bytes
Redo Buffers 8519680 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning option
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
Backup of control file has been created in trace file and edited as follow
</span>
<br />
<pre class="brush:sql">[oracle@dev-6 tmp]$ vi control.ctl
CREATE CONTROLFILE REUSE DATABASE "DEV" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/dev/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/dev/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/app/oracle/oradata/dev/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/dev/system01.dbf',
'/u01/app/oracle/oradata/dev/sysaux01.dbf',
'/u01/app/oracle/oradata/dev/undotbs01.dbf',
'/u01/app/oracle/oradata/dev/users01.dbf',
'/u01/app/oracle/oradata/dev/USER.dbf',
'/u01/app/oracle/oradata/dev/DATA.dbf',
'/u01/app/oracle/oradata/dev/DATA_INDEX.dbf',
'/u01/app/oracle/oradata/dev/REFERENCE.dbf',
'/u01/app/oracle/oradata/dev/REFERENCE_INDEX.dbf',
'/u01/app/oracle/oradata/dev/ARCHIVE.dbf',
'/u01/app/oracle/oradata/dev/apex01.dbf'
CHARACTER SET AL32UTF8
;
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE','DISK TO ''/nim_backup/backup/oracle/db/dev/%F''');
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','ON');
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO RECOVERY WINDOW OF 7 DAYS');
RECOVER DATABASE;
-- Block change tracking was enabled, so re-enable it now.
ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
USING FILE '/u01/app/oracle/oradata/dev/bct_01.log' REUSE;
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/dev/temp01.dbf' REUSE;
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
Let's try to create new control files and open database
</span>
<br />
<pre class="brush:sql">[oracle@dev-6 tmp]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jul 1 09:43:45 2014
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 option
SQL> @control.ctl
Control file created.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Media recovery complete.
Database altered.
System altered.
Database altered.
Tablespace altered.
SQL> alter database flashback on;
Database altered.
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------------------------------------------------------------
YES
SQL>
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
Database has been started and opened - all done. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">I blogged about that cause I have to solve this problem several time when due to space restriction flashback logs
has been deleted by other DBA manually instead of disabling and enabling flashback on database.
Just keep in mind if you need to release space in FRA don't delete flashback logs manually but turn off flashback on the database </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards, </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin
</span>
<br />
<br /></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com3tag:blogger.com,1999:blog-7461233846321640962.post-7074212559484590392014-06-26T18:01:00.000+01:002014-06-26T18:03:05.967+01:00Top Linux processes and Oracle<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Today due to application bug I had to check several time mapping between Linux PID processes and Oracle sessions. With small BASH script this is quite easy now</span><br />
<pre class="brush:bash">#!/bin/bash
# ps doesn't show real time CPU usage but average - skewed for long running processed
#TOP5=`ps xo pid --sort pcpu | tail -5 | xargs echo | sed -e 's/\s/,/g'`
TOP5=`top -b -d 1 -n 1 | head -12 | tail -5 | awk '{print $1;}' | xargs echo | sed -e 's/\s/,/g'`
sqlplus / as sysdba <<-EOF
set linesize 200 pagesize 999
select spid, s.username, s.program, sql_id, event from v\$session s, v\$process p where s.paddr = p.addr and spid in ($TOP5);
exit
EOF
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-70700830292599412122014-06-24T23:02:00.001+01:002014-06-24T23:02:26.785+01:00Rolling upgrads using logical standby database.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Couple of weeks ago there was a Twitter <a href="https://twitter.com/MartinDBA/status/478532956072337408">discussion </a>started by Martin Bach (@MartinDBA) about cases for logical standby implementation. A rolling upgrade was mentioned by Tim Gorman (@timothyjgormanas) as one of potential recommendations for using this rare use product. I have been involved in such project in the past and I prepared an instruction and did quite large number of rolling upgrades from 11.1 into 11.2.<br /><br />There are couple of my “gotchas”</span><br />
<ul style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">Support for data types – make sure that all data type in your application are supported by logical standby</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Support for Oracle features like reference partitioning or compression</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Logging all apply related errors during a logical standby phase</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Keep DML operations running on big dataset to minimum – keep in mind that update tab1 set col1=2 will be translated into separated update for every row in table and you really want to avoid it.</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Compatible parameter – if you are using flashback to rollback changes you can change compatible parameter with restore points</span></li>
</ul>
<span style="font-family: Arial,Helvetica,sans-serif;">If you checked that all your types and features are supported this is a list of advantage you can get from rolling upgrade:</span><br />
<ul style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">Keep your application downtime low – in reality we have an average downtime around 3 min (including additional restart of instance to remove a restore points and change compatible parameter)</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">If you have a problems with upgrading you can rollback it quite easy and revert logical standby into physical </span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Your upgrade script can work longer as your primary database is still running</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">After upgrade you can have a read only access to your production database for tests if needed</span></li>
</ul>
<div style="text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;"><br />There are two good Oracle white papers about Rolling upgrades :</span></div>
<ul style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">First using a manual steps - <a href="http://www.oracleimg.com/technetwork/database/features/availability/maa-wp-11g-transientlogicalrollingu-1-131927.pdf">Oracle Best Practices for High Availability Database Rolling Upgrade Using Transient Logical Standby Oracle Data Guard 11g</a></span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">Second using script provided by Oracle - <a href="http://www.oracle.com/us/products/database/maa-wp-11g-upgrades-made-easy-131972.pdf">Database Rolling Upgrades Made Easy by Using a Data Guard Physical Standby Database</a> </span></li>
</ul>
<div style="text-align: left;">
<span style="font-family: Arial,Helvetica,sans-serif;"><br />First one is longer and required more work but also can give you more control over the process. Second one is more automated and easier but you have less control over switchover time.<br /><br />This is I hope a first post from rolling upgrade series – in next one I will post more details about manual process.<br /><br />Regards,<br />Marcin <br /></span></div>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-46293083708004683572014-04-05T19:27:00.000+01:002014-04-05T19:28:05.325+01:00Grid Infrastructure upgrade to 11.2.0.4 on AIX - always read log files<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Oracle Restart 11.2.0.3 and same version of database has to be upgraded into 11.2.0.4. Looks like quite easy task but I hit some problems with it.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">I had 31.9 GB free and OUI through error about disk space. Fair enough cause it also proposed a parameter to ignore it. Current version of GI (11.2.0.3) occupied around 25 GB so i though it will be OK to use a parameter.</span><br />
<br />
<pre class="brush:bash">-bash-3.2$ ./runInstaller -silent -responseFile /software/oracle/database/aix/grid_reponse_file_11204.rsp \
-waitforcompletion -ignoreDiskWarning
********************************************************************************
Your platform requires the root user to perform certain pre-installation
OS preparation. The root user should run the shell script 'rootpre.sh' before
you proceed with Oracle installation. rootpre.sh can be found at the top level
of the CD or the stage area.
Answer 'y' if root has run 'rootpre.sh' so you can proceed with Oracle
installation.
Answer 'n' to abort installation and then ask root to run 'rootpre.sh'.
********************************************************************************
Has 'rootpre.sh' been run by root on all nodes? [y/n] (n)
y
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 190 MB. Actual 1265 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16512 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-04-01_08-46-59AM. Please wait ...[WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oraInventory/logs/installActions2014-04-01_08-46-59AM.log
ACTION: Identify the list of failed prerequisite checks from the log: /u01/app/oraInventory/logs/installActions2014-04-01_08-46-59AM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2014-04-01_08-46-59AM.log
You may not have enough space on your drive for a successful install. Do you still want to continue?
y
The installation of Oracle Grid Infrastructure 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2014-04-01_08-46-59AM.log' for more details.
As a root user, execute the following script(s):
1. /u01/app/grid/product/11.2.0/grid4/rootupgrade.sh
As install user, execute the following script to complete the configuration.
1. /u01/app/grid/product/11.2.0/grid4/cfgtoollogs/configToolAllCommands RESPONSE_FILE=<response_file>
Note:
1. This script must be run on the same host from where installer was run.
2. This script needs a small password properties file for configuration assistants that require passwords (refer to install guide documentation).
Successfully Setup Software.
</response_file></pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Actually note to myself - CHECK LOGS - especially oraInstall<date>.err and silentInstall<date>.log and to not trust OUI that installation was successful.</date></date></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">In next step I run I run rootupgrade but there was execution permissions errors for these files: rootadd_rdbms.sh, rootadd_filemap.sh, setowner.sh</span><br />
<pre class="brush:bash">/u01/app/grid/product/11.2.0/grid4/rootupgrade.sh[8]: /u01/app/grid/product/11.2.0/grid4/network/install/sqlnet/setowner.sh: 0403-006 Execute permission denied.
/u01/app/grid/product/11.2.0/grid4/rootupgrade.sh[13]: /u01/app/grid/product/11.2.0/grid4/rdbms/install/rootadd_rdbms.sh: 0403-006 Execute permission denied.
/u01/app/grid/product/11.2.0/grid4/rootupgrade.sh[15]: /u01/app/grid/product/11.2.0/grid4/rdbms/install/rootadd_filemap.sh: 0403-006 Execute permission denied.
Using configuration parameter file: /u01/app/grid/product/11.2.0/grid4/crs/install/crsconfig_params
Creating trace directory
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">I checked it on OS and well it was true</span><br />
<pre class="brush:bash">-bash-3.2$ ls -l /u01/app/grid/product/11.2.0/grid4/rdbms/install/rootadd_rdbms.sh
-rw-r--r-- 1 grid oinstall 2999 Apr 01 09:24 /u01/app/grid/product/11.2.0/grid4/rdbms/install/rootadd_rdbms.sh
-bash-3.2$ ls -l /u01/app/grid/product/11.2.0/grid4/rdbms/install/rootadd_filemap.sh
-rw-r--r-- 1 grid oinstall 1105 Apr 01 09:31 /u01/app/grid/product/11.2.0/grid4/rdbms/install/rootadd_filemap.sh
-bash-3.2$ ls -l /u01/app/grid/product/11.2.0/grid4/network/install/sqlnet/setowner.sh
-rw-r--r-- 1 grid oinstall 341 Apr 01 09:31 /u01/app/grid/product/11.2.0/grid4/network/install/sqlnet/setowner.sh
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">OK - maybe I could fix it but at this time I checked error log and it was much more errors</span><br />
<pre class="brush:bash">oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp100. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp101. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp102. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp103. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp104. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp105. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp106. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp107. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp108. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp109. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp110. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp111. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp112. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp113. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp114. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp115. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp116. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp117. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp118. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp119. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp120. Please create more space at this location and try again.
oracle.sysman.oii.oiif.oiifb.OiifbCancelException: OUI-10096:You may not have enough space to write to /tmp/OraInstall2014-04-01_08-46-59AM/dtemp121. Please create more space at this location and try again.
java.io.FileNotFoundException: /tmp/OraInstall2014-04-01_08-46-59AM/setpermslog.err (There is not enough space in the file system.)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:205)
at java.io.FileOutputStream.<init>(FileOutputStream.java:96)
at oracle.sysman.oii.oiij.OiijFastCopyPhase.execPermissions(OiijFastCopyPhase.java:1245)
at oracle.sysman.oii.oiij.OiijFastCopyPhase.doFastModeOperations(OiijFastCopyPhase.java:542)
at oracle.sysman.oii.oiif.oiifw.OiifwInstallPhaseWCCE$OiifwComponentIP1WCCE.doOperation(OiifwInstallPhaseWCCE.java:1980)
at oracle.sysman.oii.oiif.oiifb.OiifbCondIterator.iterate(OiifbCondIterator.java:171)
at oracle.sysman.oii.oiif.oiifw.OiifwInstallPhaseWCCE.doOperation(OiifwInstallPhaseWCCE.java:897)
at oracle.sysman.oii.oiif.oiifb.OiifbCondIterator.iterate(OiifbCondIterator.java:171)
at oracle.sysman.oii.oiif.oiifw.OiifwActionsPhaseWCDE.doOperation(OiifwActionsPhaseWCDE.java:641)
at oracle.sysman.oii.oiif.oiifb.OiifbLinearIterator.iterate(OiifbLinearIterator.java:147)
at oracle.sysman.oii.oiic.OiicInstallAPISession$OiicAPISelCompsInstall.doOperation(OiicInstallAPISession.java:1095)
at oracle.sysman.oii.oiif.oiifb.OiifbCondIterator.iterate(OiifbCondIterator.java:171)
at oracle.sysman.oii.oiic.OiicInstallAPISession.doInstallAction(OiicInstallAPISession.java:679)
at oracle.sysman.oii.oiic.OiicInstallAPISession.access$000(OiicInstallAPISession.java:94)
at oracle.sysman.oii.oiic.OiicInstallAPISession$OiicActionsThread.run(OiicInstallAPISession.java:971)
</init></init></pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Strange enough there were errors related to /tmp space not a GRID HOME location - I have verified all logs files again:</span><br />
<pre class="brush:bash">Starting Oracle Universal Installer...
Checking Temp space: must be greater than 190 MB. Actual 1265 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16512 MB Passed
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">So far looks OK but </span>
<br />
<pre class="brush:bash">Free Space: itd11:/u01/app/grid/product/11.2.0/grid4: This is a prerequisite condition to test whether sufficient free space is available in the file system.
INFO: Severity:IGNORABLE
INFO: OverallStatus:SUCCESSFUL
INFO: -----------------------------------------------
INFO: Verification Result for Node:itd11
INFO: Expected Value:12GB
INFO: Actual Value:30.5491GB
INFO: -----------------------------------------------
INFO: *********************************************
INFO: Free Space: itd11:/tmp: This is a prerequisite condition to test whether sufficient free space is available in the file system.
INFO: Severity:IGNORABLE
INFO: OverallStatus:VERIFICATION_FAILED
INFO: -----------------------------------------------
INFO: Verification Result for Node:itd11
INFO: Expected Value:1GB
INFO: Actual Value:915.3164MB
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">OK there is 85 MB MB shortage in /tmp filesystem, cause some of space has been allocated already by OUI itself. </span><span style="font-family: Arial,Helvetica,sans-serif;">I can't complain about disk error problem as I forced OUI to ignore it but I would really appreciate if OUI doesn't display successful feedback when something went wrong ;) <br /> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">I do a proper cleanup of /tmp and re-run process </span><br />
<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Note to myself : Remember do not trust output of command and always read logs</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">PS.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">That remind me one guy I used to know who work as developer. By default all his programs end up with exit(0) C function so if you check error code there was not errors at all.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
<br /></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-18956029157611760172014-03-19T22:04:00.000+00:002014-03-19T22:04:30.662+00:00Automated Linux VM build on ESX<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">How to automatically install RedHat like (Red Hat, Cent OS, Oracle Enterprise Linux) Linux system on ESX or VirtualBox servers ? There are at least two methods. I have seen VM cloning in lot of places using ESX (VSphere Center) or VirtualBox functionality. Cloning is fine but it required some intervention after clone will be finished (like host rename or IP address change). What if we want to install different releases of systems - well it is required to have a clone of every single release like RedHat 6.2, OEL 6.3 or OEL 6.4. It require a rework every time a new release is available on the market</span>.<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">But there is a another method - developed years ago well before virtualization era. It is based on installation answer file and KickStart installation method. If I add DHCP and TFTP and NFS server to this equation I will get nice and quite configurable way to build my VMs very fast. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">First of all DHCP server has to be configured. In my case I just created a internal network inside ESX and setup an additional DHCP sever for build purpose only. You can use any DHCP server but it has to be able to support TFTP redirection and also booting functionality. In my base I'm using DHCP, TFTP and NFS server provided by Ubuntu 13.04</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">DHCP configuration</span><br />
<pre>root@myown:~# cat /etc/dhcp/dhcpd.conf
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "priv.localdomain";
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option domain-name-servers 192.168.1.20;
subnet 10.0.0.0 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.1 10.0.0.100;
filename "pxelinux.0";
next-server 10.0.0.250;
}
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">PXELINUX.0 has to be copied from default location into TFTP directory and it has to be accessible by it. You can find "pxelinux.0" file in Ubuntu syslinux-common package.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Install it using "<span style="font-family: "Courier New",Courier,monospace;">apt-get install syslinux-common</span>" and then copy from it's default location into /tftpboot</span><br />
<pre>root@myown:~# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">TFTP configuration - default port and /tftpboot used as files location</span><br />
<pre>pioro@myown:/etc$ cat /etc/xinetd.d/tftp
service tftp
{
protocol = udp
port = 69
bind = 10.0.0.250
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
}
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">TFTP directory structure</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span>
<br />
<pre>pioro@myown:/tftpboot$ ls -l
total 37816
-rw-r--r-- 1 root root 34551609 Dec 22 17:04 initrd.img
-rw-r--r-- 1 root root 26461 Dec 22 17:26 pxelinux.0
drwxr-xr-x 2 root root 4096 Jan 13 22:02 pxelinux.cfg
-r--r--r-- 1 root root 441 Dec 22 17:04 TRANS.TBL
-rwxr-xr-x 1 root root 4128944 Dec 22 17:04 vmlinuz
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">PXELINUX.CFG directory inside TFTP directory</span><br />
<pre>pioro@myown:/tftpboot/pxelinux.cfg$ ls -l
total 8
-rw-r--r-- 1 root root 137 Dec 22 18:29 01-00-0c-29-41-69-15
-rw-r--r-- 1 root root 138 Jan 13 21:55 01-00-0c-29-99-7d-3d
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Files names are related to NIC MAC addresses. For example:
01-00-0c-29-41-69-15 is first file for MAC address 00:0c:29:41-69:15<br />
Now take a look what is inside a host configuration file</span><br />
<pre>pioro@myown:/tftpboot/pxelinux.cfg$ cat 01-00-0c-29-41-69-15
default Oracle Linuxas_64
label Oracle Linuxas_64
kernel vmlinuz
append initrd=initrd.img ks=nfs:10.0.0.250:/images/ks.cfg ksdevice=eth1
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">This are boot properties created using a GRUB style and describing a kernel and initrd images. KS parameter is a configuration parameter of KickStart process. In the above example KickStart configuration file is placed on NFS server in /images directory and it's called ks.cfg. In addition to that KickStart will configure interface eth1 which is private ESX network in my case.</span><br />
</div>
<span style="font-family: Arial,Helvetica,sans-serif;">
My DHCP and TFTP server has NFS server configured as well. It's exporting only one directory /images which keep a KickStart configuration files and also is a mount point for ISO image.</span>
<br />
<pre>pioro@myown:/tftpboot/pxelinux.cfg$ cat /etc/exports
/images/ *(ro,subtree_check,crossmnt)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
ISO with Linux distribution should be mounted below /images directory using loop option.</span>
<br />
<pre>root@myown:~# mount -o loop /nfs/disk2/images/OEL65.iso /images/OEL65/
mount: block device /nfs/disk2/images/OEL65.iso is write-protected, mounting read-only
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
Now I have a access to installation files and also to PXE boot files. In my case all have been located in the following directory /images/OEL65/images/pxeboot/ and I just copied it into TFTP /tftpboot directory</span>
<br />
<pre>root@myown:~# ls -l /images/OEL65/images/pxeboot/
total 37775
-rw-r--r-- 2 root root 34551609 Nov 26 05:02 initrd.img
-r--r--r-- 1 root root 441 Nov 26 05:04 TRANS.TBL
-rwxr-xr-x 2 root root 4128944 Nov 26 05:02 vmlinuz
root@myown:~# cp /images/OEL65/images/pxeboot/* /tftpboot/
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
Inside NFS exported directory I have also KickStart configuration files</span>
<br />
<pre>pioro@myown:/images$ ls -l
total 12
-rw-r--r-- 1 root root 1935 Jan 13 21:59 ks2.cfg
-rw-r--r-- 1 root root 1936 Jan 13 22:00 ks.cfg
drwxr-xr-x 2 root root 4096 Dec 22 18:27 OEL65
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Example Kickstart configuration file</span><br />
<pre>pioro@myown:/images$ cat dg1.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
nfs --server 10.0.0.250 --dir /images/OEL65/
#cdrom
# Root password
rootpw --plaintext <password>
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Europe/Dublin
# Network information
network --bootproto=static --device=eth0 --ip=192.168.1.51 --nameserver=192.168.1.20 --netmask=255.255.255.0 --onboot=on --hostname=dg1.localhost
network --bootproto=static --device=eth1 --ip=10.0.0.1 --netmask=255.255.255.0 --onboot=on
# network --bootproto=dhcp --device=eth2 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype ext4 --size=200
part pv.01 --size=1 --grow
volgroup VolGroup pv.01
logvol swap --fstype swap --vgname=VolGroup --size=1024 --name=lv_swap
logvol / --fstype ext4 --vgname=VolGroup --size=1 --grow --name=lv_root
%packages
@base
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@large-systems
@network-file-system-client
@performance
@perl-runtime
@security-tools
@server-platform
@server-policy
@system-admin-tools
gcc
%end </password></pre>
<pre><password>
</password></pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Above configuration file will partition a disk into root and swap partition and configure two networks. In addition to that packages groups specified after %packages line will be installed.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Below are screen shots from my ESX environment:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Finding a MAC address of VM - Open VM configuration and go to Network adapters</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-bAGvvqTa0Nc/UynPPq5Wg3I/AAAAAAAABSY/Ix1DDDD3T-I/s1600/mac.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-bAGvvqTa0Nc/UynPPq5Wg3I/AAAAAAAABSY/Ix1DDDD3T-I/s1600/mac.png" height="280" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Booting process - this VM is booting from NIC 2 using private network and all services configured above.</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-sOVlGRbp8PM/UynPPrYb1CI/AAAAAAAABSc/3K-J9i_EPo4/s1600/booting.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-sOVlGRbp8PM/UynPPrYb1CI/AAAAAAAABSc/3K-J9i_EPo4/s1600/booting.png" height="224" width="320" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">If you looking to step by step instructions you can find it on Tim Hall website:</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><a href="http://www.oracle-base.com/articles/linux/pxe-network-installations-ol6-and-rhel6.php">PXE Network installations </a></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><a href="http://www.oracle-base.com/articles/linux/kickstart.php">KickStart</a></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">I based my environment build on Tim's website and some Google research. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Happy installing !!!</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span><br />
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-18696813670898856602013-10-25T20:41:00.002+01:002013-10-25T20:41:18.031+01:00OraSASH visualization<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Hello,</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">I started working on that project 2 years ago and at that stage I created a JavaScript code to display real time graphs and parse JSON code. The backend providing JSON data from Oracle Database was based on PHP and I didn't like that solution as it required to much configuration so project has been postponed.<br /><br />Couple of weeks ago I discovered NodeJS and I decided to come back to my old project and this time use this lightweight server to work as backend server. I couldn't find NodeJS database driver for Oracle but I decide to present performance data using DBMS_EPG and PL/SQL procedures. Data are taken from OraSASH (but it can be used for ASH/AWR as well) and encoded as JSON. Browser is using AJAX to call NodeJS and NodeJS is connecting to Oracle DB to take required data. <br /><br />This project is on very early stage so stay tuned - you can find initial code <a href="https://github.com/pioro/visash" target="_blank">here</a><br /><br />Please find screen shots from VISASH project:</span> <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-EJcrJK_bWOs/UmrIAaZrELI/AAAAAAAABPk/i9QwV9DRNEM/s1600/single.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="340" src="http://1.bp.blogspot.com/-EJcrJK_bWOs/UmrIAaZrELI/AAAAAAAABPk/i9QwV9DRNEM/s640/single.png" width="640" /></a></div>
<span style="font-family: Arial,Helvetica,sans-serif;">One instance view </span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-0yfMJwZ2ej8/UmrIAD1PcGI/AAAAAAAABPg/AkWPlpOA128/s1600/compare.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="339" src="http://4.bp.blogspot.com/-0yfMJwZ2ej8/UmrIAD1PcGI/AAAAAAAABPg/AkWPlpOA128/s640/compare.png" width="640" /></a></div>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Two instances view</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-_2XkjmPDIek/UmrEDviIscI/AAAAAAAABPY/qzQLFcZbM8Q/s1600/TECH13_ResourcePk_ISA_V2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="130" src="http://1.bp.blogspot.com/-_2XkjmPDIek/UmrEDviIscI/AAAAAAAABPY/qzQLFcZbM8Q/s400/TECH13_ResourcePk_ISA_V2.gif" width="400" /></a></div>
<span style="font-family: Arial,Helvetica,sans-serif;"> </span>
<br />
<pre><span style="font-family: Arial,Helvetica,sans-serif;">
</span></pre>
<pre><span style="font-family: Arial,Helvetica,sans-serif;"> </span></pre>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com1tag:blogger.com,1999:blog-7461233846321640962.post-35617740987326555662013-10-25T20:18:00.003+01:002013-10-25T20:42:25.016+01:00New release candidate of OraSASH<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Hi,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">There is a new release candidate of OraSASH 2.4 available on github - <a href="https://github.com/pioro/orasash/tree/v2.4-rc2">https://github.com/pioro/orasash/tree/v2.4-rc2</a></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">This version is providing much more views and it's easier to use your existing AWR queries against OraSASH. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-_2XkjmPDIek/UmrEDviIscI/AAAAAAAABPU/LHSai8iSdbc/s1600/TECH13_ResourcePk_ISA_V2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="130" src="http://4.bp.blogspot.com/-_2XkjmPDIek/UmrEDviIscI/AAAAAAAABPU/LHSai8iSdbc/s400/TECH13_ResourcePk_ISA_V2.gif" width="400" /></a></div>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-49256972529980313042013-07-30T19:23:00.000+01:002013-07-30T19:23:04.983+01:00How to improve VMware performance on your PC<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">I found very interesting post here - <a href="http://artykul8.com/2012/06/vmware-performance-enhancing/" target="_blank">VMware Performance Enhancing Tweaks (Over-the-Counter Solutions)</a>. I used it on my VMware Player and Workstation and when I disabled vmem file my laptop it stopped blinking HDD led for 5 - 10 min every time it wake up from sleep mode.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com0tag:blogger.com,1999:blog-7461233846321640962.post-35444866750230292802013-07-28T18:10:00.000+01:002013-10-25T20:19:14.248+01:00DataGuard – Far Sync – part 2 - Data Guard Broker<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Oracle introduced Far Sync Data Guard configuration which I described briefly in this <a href="http://oracleprof.blogspot.ie/2013/07/dataguard-far-sync-part-1-simple.html" target="_blank">post</a>. Now is time for part two and using Data Guard Broker to add Far Sync instance.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Assuming that you have basic Data Guard Broker configuration ready (as described in - <a href="http://oracleprof.blogspot.ie/2013/07/how-to-quickly-build-standby-database.html" target="_blank">How to quickly build standby database and setup DataGuard configuration using Oracle 12c</a>) adding new Far Sync instance is quite easy task.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">First we have to setup a new instance which will be used as Far Sync for our primary database.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">Instance parameter file - as a copy of primary database configuration (not necessary)</span><br />
<pre>*.audit_file_dest='/home/oracle/admin/test12c/adump'
*.audit_trail='db'
*.compatible='12.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/test12c/control01.ctl','/u01/app/oracle/oradata/test12c/control02.ctl','/u01/app/oracle/oradata/test12c/control03.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='test12c'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=test12cXDB)'
*.log_archive_dest_1='location=/u01/app/oracle/oradata/test12c/arch'
*.open_cursors=300
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=450m
*.undo_tablespace='UNDOTBS1'
# for far sync
*.db_unique_name='test12c_far_sync'
*.LOG_FILE_NAME_CONVERT='test','test'
*.local_listener='(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.60)(PORT = 1522)))'
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">There are three parameters which have to be changed:</span><br />
<ul style="text-align: left;">
<li><span style="font-family: Arial,Helvetica,sans-serif;">db_unique_name </span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">local_listener - new instance has to be registered in proper listener</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">log_file_name_convert - it is useful to have even with dummy values so Oracle can recreate standby logs automatically</span></li>
</ul>
<span style="font-family: Arial,Helvetica,sans-serif;">Listener configuration</span>
<br />
<pre>SID_LIST_LISTENER_DG =
(SID_LIST =
(SID_DESC=
(ORACLE_HOME= /u01/app/oracle/product/12.1.0/db1)
(SID_NAME=test12c)
)
(SID_DESC =
(SID_NAME = test12c)
(GLOBAL_DBNAME = test12c_far_sync_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db1)
)
)
LISTENER_DG =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCDG1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.60)(PORT = 1522))
)
)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">tnsnames file - entry
test12c_far_sync has to be added on primary and standby server as well </span>
<br />
<pre>test12c_prim =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.45)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER=dedicated)
)
)
test12c_std =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.79)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER=dedicated)
)
)
test12c_far_sync =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.60)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER=dedicated)
)
)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">When instance parameter file and network configuration is ready we need to create Far Sync control file on primary server.</span>
<br />
<pre>[oracle@ora12c dbs]$ rlwrap sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jul 26 23:21:59 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> ALTER DATABASE CREATE FAR SYNC INSTANCE CONTROLFILE AS '/tmp/farsync.ctl';
Database altered.
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Copy it to Far Sync server</span>
<br />
<pre>[oracle@ora12c dbs]$ scp /tmp/farsync.ctl 192.168.1.60:/u01/app/oracle/oradata/test12c/control01.ctl
oracle@192.168.1.60's password:
farsync.ctl 100% 10MB 10.3MB/s 00:00
[oracle@ora12c dbs]$ scp /tmp/farsync.ctl 192.168.1.60:/u01/app/oracle/oradata/test12c/control02.ctl
oracle@192.168.1.60's password:
farsync.ctl 100% 10MB 10.3MB/s 00:01
[oracle@ora12c dbs]$ scp /tmp/farsync.ctl 192.168.1.60:/u01/app/oracle/oradata/test12c/control03.ctl
oracle@192.168.1.60's password:
farsync.ctl 100% 10MB 10.3MB/s 00:00
[oracle@ora12c dbs]$
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Now Far Sync instance can be started and new standby logs could be created. Make sure if Data Guard Broker has been started as well.</span>
<br />
<pre>[oracle@oraclese dbs]$ rlwrap sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jul 26 23:24:27 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup mount
ORACLE instance started.
Total System Global Area 471830528 bytes
Fixed Size 2289688 bytes
Variable Size 293605352 bytes
Database Buffers 167772160 bytes
Redo Buffers 8163328 bytes
Database mounted.
SQL> alter system set dg_broker_start = true;
System altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/test12c/standby01.log') size 50M reuse;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/test12c/standby02.log') size 50M reuse;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/test12c/standby03.log') size 50M reuse;
Database altered.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Like if previous post about Data Guard configuration - Broker will be used to do all configuration work. You should to connect to Broker from primary database.
This is how current configuration looks like:</span>
<br />
<pre>[oracle@ora12c ~]$ rlwrap dgmgrl /
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected as SYSDG.
DGMGRL> connect /
Connected as SYSDG.
DGMGRL> show configuration verbose;
Configuration - fsc
Protection Mode: MaxPerformance
Databases:
test12c_prim - Primary database
test12c_std - Physical standby database
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Adding Far Sync</span>
<br />
<pre>DGMGRL> add far_sync test12c_far_sync as connect identifier is 'test12c_far_sync';
far sync instance "test12c_far_sync" added
DGMGRL> show configuration verbose;
Configuration - fsc
Protection Mode: MaxPerformance
Databases:
test12c_prim - Primary database
test12c_std - Physical standby database
test12c_far_sync - Far Sync (disabled)
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Now new rules for redo log transport have to be configured</span>
<br />
<pre>DGMGRL> edit database 'test12c_prim' set property redoroutes='(local : test12c_far_sync sync)';
Property "redoroutes" updated
DGMGRL> edit far_sync 'test12c_far_sync' set property redoroutes='(test12c_prim : test12c_std)';
Property "redoroutes" updated
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Above configuration is sending redo data from primary database to far sync instance using SYNC mode and redo data from far sync instance to standby database using ASYNC mode. As primary and far sync instance are close one to each other you can have no data loss mode without additional network synchronization overhead. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Redo logs routing rules are described in <a href="http://docs.oracle.com/cd/E16655_01/server.121/e17641/dbpropref.htm#DGBKR3657" target="_blank">Oracle documentation</a>.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Enabling and checking configuration</span>
<br />
<pre>DGMGRL> enable far_sync test12c_far_sync;
Enabled.
DGMGRL> show configuration verbose;
Configuration - fsc
Protection Mode: MaxPerformance
Databases:
test12c_prim - Primary database
test12c_far_sync - Far Sync
test12c_std - Physical standby database
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">If everything is OK we can switch protection mode from Maximum Performance to Maximum Availability to get all advantages of our new configured Far Sync instance.</span>
<br />
<pre>DGMGRL> edit configuration set protection mode as MaxAvailability;
Succeeded.
DGMGRL> show configuration verbose;
Configuration - fsc
Protection Mode: MaxAvailability
Databases:
test12c_prim - Primary database
test12c_far_sync - Far Sync
test12c_std - Physical standby database
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Now all is done. Happy testing. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com2tag:blogger.com,1999:blog-7461233846321640962.post-25920709928958486152013-07-27T13:26:00.000+01:002013-07-27T13:26:32.214+01:00How to quickly build standby database and setup DataGuard configuration using Oracle 12c<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">With every release of Oracle database there are new possibilities to build a required solution (ex. standby database) faster and with fewer steps. This is not official guide but rather a mix of Oracle 12c functionality used to build DataGuard configuration using RMAN and DataGuard Broker.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br />Assumptions:</span><br />
<ul>
<li><span style="font-family: Arial,Helvetica,sans-serif;">There is a database which will be used as primary.</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">New listener will be added to support standby traffic</span></li>
</ul>
<b><span style="font-family: Arial,Helvetica,sans-serif;">Steps to run on primary database</span></b><br />
<br />
<i><span style="font-family: Arial,Helvetica,sans-serif;">Listener configuration</span></i><br />
<pre>LISTENER_DG =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCDG1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.45)(PORT = 1522))
)
)
SID_LIST_LISTENER_DG =
(SID_LIST =
(SID_DESC=
(ORACLE_HOME= /u01/app/oracle/product/12.1.0/db1)
(SID_NAME=test12c)
)
(SID_DESC =
(SID_NAME = test12c)
(GLOBAL_DBNAME = test12c_prim_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db1)
)
)
</pre>
<i><span style="font-family: Arial,Helvetica,sans-serif;">tnsnames entries</span></i>
<br />
<pre>test12c_std =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.79)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER = dedicated)
)
)
test12c_prim =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.45)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER = dedicated)
)
)
</pre>
<br />
<i><br /></i>
<i><span style="font-family: Arial,Helvetica,sans-serif;">New parameters for database</span></i><br />
<pre>[oracle@ora12c ~]$ rlwrap sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jul 26 21:02:14 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter system set local_listener='(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.45)(PORT = 1522)))';
System altered.
SQL> alter system set db_unique_name='test12c_prim' scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 471830528 bytes
Fixed Size 2289688 bytes
Variable Size 255856616 bytes
Database Buffers 209715200 bytes
Redo Buffers 3969024 bytes
Database mounted.
Database opened.
</pre>
<div>
<i><span style="font-family: Arial,Helvetica,sans-serif;">New control file for standby</span></i></div>
<pre>SQL> alter database create standby controlfile as '/tmp/standby.ctl' reuse;
Database altered.
</pre>
<div>
<i><span style="font-family: Arial,Helvetica,sans-serif;">Copy standby control file to standby server</span></i></div>
<pre>[oracle@ora12c ~]$ scp -i /home/oracle/oracle_standby.key /tmp/standby.ctl oracle@10.0.1.79:/u01/app/oracle/oradata/test12c/control01.ctl
standby.ctl 100% 10MB 438.0KB/s 00:24
[oracle@ora12c ~]$ scp -i /home/oracle/oracle_standby.key /tmp/standby.ctl oracle@10.0.1.79:/u01/app/oracle/oradata/test12c/control02.ctl
standby.ctl 100% 10MB 438.0KB/s 00:24
[oracle@ora12c ~]$ scp -i /home/oracle/oracle_standby.key /tmp/standby.ctl oracle@10.0.1.79:/u01/app/oracle/oradata/test12c/control03.ctl
standby.ctl 100% 10MB 438.0KB/s 00:24
</pre>
<br />
<b><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Steps to run on new standby database</span></span></b><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><i>Database parameter file</i> - it could be a copy of primary database file with two changes - db_unique_name and local_listener</span>
<br />
<pre>*.audit_file_dest='/home/oracle/admin/test12c/adump'
*.audit_trail='db'
*.compatible='12.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/test12c/control01.ctl','/u01/app/oracle/oradata/test12c/control02.ctl','/u01/app/oracle/oradata/test12c/control03.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='test12c'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=test12cXDB)'
*.log_archive_dest_1='location=/u01/app/oracle/oradata/test12c/arch'
*.open_cursors=300
*.pga_aggregate_target=150m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=450m
*.undo_tablespace='UNDOTBS1'
# changes for standby
*.db_unique_name='test12c_std'
*.local_listener='(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.79)(PORT = 1522)))'
</pre>
<i><span style="font-family: Arial,Helvetica,sans-serif;">Listener configuration</span></i>
<br />
<pre>LISTENER_DG =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROCDG1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.79)(PORT = 1522))
)
)
SID_LIST_LISTENER_DG =
(SID_LIST =
(SID_DESC=
(ORACLE_HOME= /u01/app/oracle/product/12.1.0/db1)
(SID_NAME=test12c)
)
(SID_DESC =
(SID_NAME = test12c)
(GLOBAL_DBNAME = test12c_std_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/db1)
)
)
</pre>
<i><span style="font-family: Arial,Helvetica,sans-serif;">tnsnames entries</span></i>
<br />
<pre>test12c_std =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.79)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER = dedicated)
)
)
test12c_prim =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.45)(PORT = 1522))
)
(CONNECT_DATA =
(SID = test12c)
(SERVER = dedicated)
)
)</pre>
<pre> </pre>
<span style="font-family: Arial,Helvetica,sans-serif;">In next step we have to check if all datafile and configuration directory are in place on standby machine and startup instance in mount mode.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><i>Starting up instance</i> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span>
<br />
<pre>[oracle@ip-10-0-1-79 dbs]$ rlwrap sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Jul 26 17:39:48 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup mount
ORACLE instance started.
Total System Global Area 471830528 bytes
Fixed Size 2289688 bytes
Variable Size 255856616 bytes
Database Buffers 209715200 bytes
Redo Buffers 3969024 bytes
Database mounted.
SQL>
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">RMAN restore over network is an Oracle 12c feature. Yes there was duplicate from active database in 11g but this one is much easier to run and required fewer configuration steps. To restore Oracle data files on standby server we need to configure only instance in mount mode and add tns alias to primary database.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><i>Starting RMAN and restoring data files</i> </span>
<br />
<pre>[oracle@ip-10-0-1-79 dbs]$ rlwrap rman target /
Recovery Manager: Release 12.1.0.1.0 - Production on Fri Jul 26 16:18:57 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST12C (DBID=1424547711, not open)
RMAN> restore database from service test12c_prim using compressed backupset;
Starting restore at 26-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_prim
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/test12c/system01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:08:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_prim
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/test12c/sysaux01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:08:55
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_prim
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/test12c/undotbs01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_prim
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/test12c/users01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_prim
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/test12c/soe.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:46:45
Finished restore at 26-JUL-13
RMAN>
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">At that stage we have primary and standby database almost ready. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><b><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Step to run on primary and standby database</span></span></span></b> </span><br />
<br />
<i><span style="font-family: Arial,Helvetica,sans-serif;">Starting DataGuard Broker and create standby log files</span></i><br />
<span style="font-family: Arial,Helvetica,sans-serif;"> </span>
<br />
<pre>SQL> alter system set dg_broker_start = true;
System altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/test12c/standby01.log') size 50M reuse;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/test12c/standby02.log') size 50M reuse;
Database altered.
SQL> alter database add standby logfile ('/u01/app/oracle/oradata/test12c/standby03.log') size 50M reuse;
Database altered.
</pre>
<br />
<b><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Steps to run on primary database</span></span> </span></b><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Now is time for DataGuard Broker to work for us. </span><br />
<br />
<i><span style="font-family: Arial,Helvetica,sans-serif;">Adding primary database</span></i>
<br />
<pre>[oracle@ora12c ~]$ rlwrap dgmgrl /
DGMGRL for Linux: Version 12.1.0.1.0 - 64bit Production
Copyright (c) 2000, 2012, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected as SYSDG.
DGMGRL> connect /
Connected as SYSDG.
DGMGRL> create configuration FSC as primary database is test12c_prim connect identifier is 'test12c_prim';
Configuration "fsc" created with primary database "test12c_prim"</pre>
<pre> </pre>
<i><span style="font-family: Arial,Helvetica,sans-serif;">Adding standby database and displaying configuration</span></i>
<br />
<pre>DGMGRL> add database test12c_std as connect identifier is 'test12c_std' maintained as physical;
Database "test12c_std" added
DGMGRL> show configuration verbose;
Configuration - fsc
Protection Mode: MaxPerformance
Databases:
test12c_prim - Primary database
test12c_std - Physical standby database
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED</pre>
<pre> </pre>
<i><span style="font-family: Arial,Helvetica,sans-serif;">Enabling configuration and checking DataGuard status</span></i>
<br />
<pre>DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration verbose;
Configuration - fsc
Protection Mode: MaxPerformance
Databases:
test12c_prim - Primary database
test12c_std - Physical standby database
Properties:
FastStartFailoverThreshold = '30'
OperationTimeout = '30'
TraceLevel = 'USER'
FastStartFailoverLagLimit = '30'
CommunicationTimeout = '180'
ObserverReconnect = '0'
FastStartFailoverAutoReinstate = 'TRUE'
FastStartFailoverPmyShutdown = 'TRUE'
BystandersFollowRoleChange = 'ALL'
ObserverOverride = 'FALSE'
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">And our DataGuard configuration is up and running. Now we can change default configuration to one which meet our requirements. I next post I will add Far Sync instance and switch configuration to Maximum Availability.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com3tag:blogger.com,1999:blog-7461233846321640962.post-3071857101093707552013-07-16T12:50:00.002+01:002013-07-16T12:50:31.263+01:00DataGuard – Far Sync – part 1 – simple configuration<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">Oracle introduced a new feature for DataGuard called Far Sync. This configuration is design to support </span><span style="font-family: Arial,Helvetica,sans-serif;">synchronous redo transport between primary and standby database which are far apart. In usual configuration </span><span style="font-family: Arial,Helvetica,sans-serif;">synchronous redo transport between data centre in Europe and US is possible but inefficient from the primary database performance perspective. Every commit has to be written locally to redo logs and send to standby with confirmation – a network round trip between Europe and US is a significant delay for every commit operation in </span><span style="font-family: Arial,Helvetica,sans-serif;">synchronous mode. If database has to run in no data loss mode DBA had no choice but run primary in SYNC mode and suffer from every transaction network round-trip or setup both databases in data centres which are relatively close to each other. <br /><br />To mitigate that problem an Oracle 12c has introduced DataGuard Far Sync instance. Far Sync instance is a log transport "proxy" and it has to be located close to the primary database. As Far Sync is a type of instance only – there is no need to put whole database there. Far Sync instance requires space for a standby and an archive logs.<br />In that configuration primary is sending transaction to Far Sync instance in </span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"></span><span style="font-family: Arial,Helvetica,sans-serif;">synchronous </span>mode so every transaction is written to primary redo logs and Far Sync standby logs – so commit time is limited to time required for both writes and network round trip between primary and Far Sync. In next stage Far Sync instance is sending redo stream in a</span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"></span><span style="font-family: Arial,Helvetica,sans-serif;">synchronous </span> mode to standby database located in other data centre.<br /><br />In my test configuration I setup OpenVPN connection between VM running in my home ESX server (located in Europe) and two EC2 instances running in USA. That configuration allows me to measure commit time for </span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"></span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"></span><span style="font-family: Arial,Helvetica,sans-serif;">synchronous </span></span>mode with and without Far Sync instance. <br /><br />Configuration details:<br /><br />Primary database – TEST_PRM <br />Far sync instance – FARSYNC<br />Standby database – TEST_STD</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Primary database configuration – DataGuard related parameters only</span><br />
<pre>DB_UNIQUE_NAME=TEST_PRM
FAL_SERVER=TEST_STD
LOG_ARCHIVE_CONFIG='DG_CONFIG=( TEST_PRM,FARSYNC, TEST_STD)'
LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME= TEST_PRM
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Standby configuration:</span>
<br />
<pre>LOG_ARCHIVE_CONFIG='DG_CONFIG=( TEST_PRM,FARSYNC, TEST_STD)'
LOG_ARCHIVE_DEST_1='location=/u01/app/oracle/oradata/test12c/arch'</pre>
<pre> </pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<b>First test case – SYNC mode redo transport between primary and standby database </b></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Primary log transport configuration
</span>
<br />
<pre>log_archive_dest_2 = 'service="TEST_STD", SYNC AFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="TEST_STD" net_timeout=10, valid_for=(online_logfile,all_roles)';
log_archive_config = 'dg_config=(TEST_PRM,TEST_STD,FARSYNC)
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
In both cases I run Swingbench against primary database and monitor time histogram for ‘log file sync’ event (primary database was restarted every time to have identical test conditions and reset counters)
</span><br />
<pre>SQL> select * from v$event_histogram where EVENT = 'log file sync';
EVENT# EVENT WAIT_TIME_MILLI WAIT_COUNT LAST_UPDATE_TIME CON_ID
---------- ------------------------------ --------------- ---------- ------------------------------------------------------------------------- ----------
144 log file sync 1 5 10-JUL-13 08.50.01.857358 PM +01:00 0
144 log file sync 2 23 10-JUL-13 08.38.51.202819 PM +01:00 0
144 log file sync 4 11 10-JUL-13 08.40.00.723312 PM +01:00 0
144 log file sync 8 2 10-JUL-13 08.59.06.068904 PM +01:00 0
144 log file sync 16 8 10-JUL-13 08.59.22.090580 PM +01:00 0
144 log file sync 32 18 10-JUL-13 08.59.29.450597 PM +01:00 0
144 log file sync 64 41 10-JUL-13 08.59.33.983966 PM +01:00 0
144 log file sync 128 62 10-JUL-13 08.59.39.447536 PM +01:00 0
144 log file sync 256 326 10-JUL-13 08.59.40.640604 PM +01:00 0
144 log file sync 512 1423 10-JUL-13 08.59.40.640691 PM +01:00 0
144 log file sync 1024 37 10-JUL-13 08.59.11.646609 PM +01:00 0
144 log file sync 2048 1 10-JUL-13 08.53.53.715921 PM +01:00 0
144 log file sync 4096 1 10-JUL-13 08.56.15.150343 PM +01:00 0
13 rows selected.
</pre>
</div>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;">
As we can see in histogram – log file sync time between 256 and 512 ms is most frequent one and commit time for most of transaction were in that time range.
In addition to Swingbench traffic I run one test transaction with simple row insert and traced it – here are important lines from trace file </span> </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">WAIT #140043716402464: nam='log file sync' ela= 184627 buffer#=419 sync scn=987285 <br /> </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">As you can see 184 ms for commit is not a great result. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><b>Second test case – SYNC mode redo transport between primary and far sync instance </b></span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Primary log transport configuration
</span>
</span><br />
<pre>LOG_ARCHIVE_DEST_2='service="FARSYNC"','SYNC AFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="FARSYNC" net_timeout=30','valid_for=(online_logfile,all_roles)' SCOPE=BOTH;
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;">
Far Sync instance required Oracle 12c binaries installed and special version of control file created on primary database using following command
</span>
</span><br />
<pre><span style="font-family: Arial,Helvetica,sans-serif;">ALTER DATABASE CREATE FAR SYNC INSTANCE CONTROLFILE AS '/tmp/farsync.ctl';
</span></pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;">
Instance parameters:
</span>
</span><br />
<pre>CONTROL_FILE=/u01/app/oracle/oradata/test12c/control01.ctl
DB_UNIQUE_NAME= FARSYNC
FAL_SERVER= TEST_PRM
LOG_FILE_NAME_CONVERT='test','test'
LOG_ARCHIVE_CONFIG='DG_CONFIG=( TEST_PRM,FARSYNC, TEST_STD)'
LOG_ARCHIVE_DEST_1 = "location=/u01/app/oracle/oradata/test12c/arch"
LOG_ARCHIVE_DEST_2='service="TEST_STD"','ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="TEST_STD" net_timeout=10','valid_for=(standby_logfile,all_roles)' SCOPE=BOTH;
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">As you can see in above configuration LOG_ARCHIVE_DEST_2 is configured as ASYNC and pointed to real standby database. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Let's run test again
<span style="font-family: Arial,Helvetica,sans-serif;">
</span>
</span><br />
<pre>SQL> select * from v$event_histogram where EVENT = 'log file sync';
EVENT# EVENT WAIT_TIME_MILLI WAIT_COUNT LAST_UPDATE_TIME CON_ID
---------- ------------------------------ --------------- ---------- ------------------------------------------------------------------------- ----------
144 log file sync 1 254 10-JUL-13 09.23.58.069192 PM +01:00 0
144 log file sync 2 364 10-JUL-13 09.23.58.027215 PM +01:00 0
144 log file sync 4 338 10-JUL-13 09.23.57.951897 PM +01:00 0
144 log file sync 8 278 10-JUL-13 09.23.57.540682 PM +01:00 0
144 log file sync 16 82 10-JUL-13 09.23.55.700236 PM +01:00 0
144 log file sync 32 29 10-JUL-13 09.23.56.896548 PM +01:00 0
144 log file sync 64 29 10-JUL-13 09.23.52.709345 PM +01:00 0
144 log file sync 128 18 10-JUL-13 09.23.40.675756 PM +01:00 0
144 log file sync 256 8 10-JUL-13 09.23.32.935084 PM +01:00 0
144 log file sync 512 18 10-JUL-13 09.23.32.949511 PM +01:00 0
144 log file sync 1024 7 10-JUL-13 09.22.50.183919 PM +01:00 0
11 rows selected.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
<span style="font-family: Arial,Helvetica,sans-serif;">
Now results are totally different – most of transactions have a commit time between 1 to 8 ms – so all transaction has been commit after writing data to primary redo and far sync standby logs.
From performance perspective this is much better and still primary database is protected in no data loss mode. Similar line from trace file:</span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">WAIT #140132880983720: nam='log file sync' ela= 1003 buffer#=63 sync scn=1042355</span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">This time commit time was almost 180 faster and took only 1 ms. </span>
<span style="font-family: Arial,Helvetica,sans-serif;"></span></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></span>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Above configuration is a simplest one and doesn't include alternate destination if Far Sync is down. When standby database become primary there is no far sync instance close to new primary and it has to be addressed as well. </span></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">I will keep my tests and I hope I will blog soon next part.</span></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;"><br /></span></span>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">regards,</span></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-family: Arial,Helvetica,sans-serif;">Marcin</span></span>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com1tag:blogger.com,1999:blog-7461233846321640962.post-30619939190505986492013-07-09T21:40:00.002+01:002013-07-09T21:40:31.517+01:00Oracle 12c - incremental backup for DataGuard over network <div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">If you have DataGuard or standby database in your organization you probably will love that new RMAN feature. Since 12c it is possible to catchup standby database using incremental backup using one command. Additional space and time need to run incremental backup, copy over to standby and restore can be limited to time required to run incremental backup over network.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">See short example:</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Stopping recovery on standby </span><br />
<br />
<pre>[oracle@ip-10-0-1-79 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sun Jul 7 12:56:24 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;
Database altered.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
</pre>
<br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Running incremental backup:</span><br />
<pre>[oracle@ip-10-0-1-79 ~]$ rman target /
Recovery Manager: Release 12.1.0.1.0 - Production on Sun Jul 7 12:56:39 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
connected to target database: TEST12C (DBID=1424547711, not open)
RMAN> recover database from service test12c_b using compressed backupset;
Starting recover at 07-JUL-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_b
destination for restore of datafile 00001: /u01/app/oracle/oradata/test12c/system01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_b
destination for restore of datafile 00002: /u01/app/oracle/oradata/test12c/sysaux01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_b
destination for restore of datafile 00003: /u01/app/oracle/oradata/test12c/undotbs01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: using compressed network backup set from service test12c_b
destination for restore of datafile 00004: /u01/app/oracle/oradata/test12c/users01.dbf
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
...
RMAN>; exit
Recovery Manager complete.
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">For anyone who spend night trying to catch up standby database above solution looks brilliant.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
<br /></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com2tag:blogger.com,1999:blog-7461233846321640962.post-77273132415172347902013-06-29T13:49:00.000+01:002013-06-29T13:49:21.573+01:00PL/SQL function in SQL - short example - Oracle 12c<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">This is my first post about Oracle 12c. When I first time heard about PL/SQL functions inside SQL my first thought was - can I use it in my <a href="http://oracleprof.blogspot.ie/2012/07/average-active-session-in-sqlplus-with.html" target="_blank">topaas</a>.sql script to run it in loop ?
I decided to give PL/SQL functions in SQL a quick try to and here are my results.
My goal was to display results from SQL line by line with small delay. This is a code a decided to use:</span>
<br />
<pre>SQL> set arraysize 1
SQL> col slow_me noprint
SQL> with function slow_me return number is
2 begin
3 dbms_lock.sleep(1);
4 return 1;
5 end;
6 select level, slow_me() slow_me from dual connect by level < 10;
7 /
LEVEL
----------
1
2
3
4
5
6
7
8
9
9 rows selected.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Unfortunately only first row is displayed alone. Rest of rows is displayed in pairs even if arraysize is set to 1. Not sure now why it happen and I would to find out some day.</span>
<span style="font-family: Arial,Helvetica,sans-serif;">After problems with pure SQL I decided to check how SQL*Plus refcursor print functionality is working. Here is second version of code:</span>
<br />
<pre>SQL> var c refcursor
SQL> declare
2 stm varchar2(1000);
3 begin
4 stm:='with function slow_me return varchar2 is
5 begin
6 dbms_lock.sleep(1);
7 return '''';
8 end;
9 select level, slow_me() slow_me from dual connect by level < 10';
10 open :c for stm;
11 end;
12 /
PL/SQL procedure successfully completed.
SQL> print c
LEVEL
----------
1
2
3
4
5
6
7
8
9
9 rows selected.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Now it's working. This code is displaying row by row with 1 sec delay. So now it is time to display some more interesting results. Code below is displaying Average Active Sessions (15s) taken from v$sysmetric view with delay defined by user</span>
<span style="font-family: Arial,Helvetica,sans-serif;">aas.sql</span>
<br />
<pre>var c refcursor
set arraysize 1
declare
sqlst varchar2(2000):='
with function aas RETURN varchar2 IS
v varchar2(100);
begin
select VALUE into v from v$sysmetric where METRIC_NAME = ''Average Active Sessions'' and INTSIZE_CSEC < 5000;
dbms_lock.sleep(&SLEEP_SEC);
v:=''Average Active Sessions '' || v;
return v;
end;
select aas() from dual connect by level < 1000';
begin
open :c for sqlst;
end;
/
print c
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">It can be run from SQL*Plus and it will be some kind of top-like utility.
</span>
<br />
<pre>[oracle@ora12c ~]$ rlwrap sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jun 29 13:34:37 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> @aas.sql
Enter value for sleep_sec: 1
old 7: dbms_lock.sleep(&SLEEP_SEC);
new 7: dbms_lock.sleep(1);
PL/SQL procedure successfully completed.
AAS()
--------------------------------------------------------------------------------
Average Active Sessions .0000153231179213857
Average Active Sessions .0000153231179213857
Average Active Sessions .0000153231179213857
Average Active Sessions .0000153231179213857
Average Active Sessions .0000153231179213857
Average Active Sessions .0000153231179213857
Average Active Sessions .0000153231179213857
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">That's only examples of new functionality. Now I have to review <a href="http://oracleprof.blogspot.ie/2012/07/average-active-session-in-sqlplus-with.html" target="_blank">topaas </a>code again and see if I can use that feature there. </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards, </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin
</span></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com3tag:blogger.com,1999:blog-7461233846321640962.post-42669632599983685592013-06-07T20:49:00.000+01:002013-06-07T20:49:19.166+01:00DataGuard FastStart Failover configuration with Oracle Wallet<div dir="ltr" style="text-align: left;" trbidi="on">
Last two months were very busy for me with lot of work and moving house as well. There is a lot of thoughts in my head I want to write about but some of them have to wait until my lab will be online again.Recently I was working on Oracle DataGuard configuration with FastStart Failover and this is what I want to share with you today.<br />
<br />
<a href="http://www.oracle.com/technetwork/articles/smiley-fsfo-084973.html" target="_blank">FastStart Failover</a> is a good solution for automatic promoting standby database to be primary and allow application to keep running in case of primary database failure. I don't want to describe whole solution here but want to focus on Observer problems I had recently.<br />
<br />
Observer is a part of DataGuard Broker running on 3rd server and it is used to prevent a brain split between primary and standby database. Observer is started by DGMGRL program and it required a sys user credentials. Customer doesn't want to keep sys password in scripts to start and stop observer so Oracle Wallet looks like a good solution to address this issue.<br />
<br />
Configuration overview:<br />
- database name - TESTDB<br />
- unique database names - TESTDB_PRIMARY and TESTDB_STANDBY<br />
<br />
Wallet has been created and sys user with alias for primary and standby database has been added to it.<br />
I was able to connect to both servers:<br />
<br />
<pre>[oracle@orasvr3 ~]$ mkstore -wrl /home/oracle/testwallet -listCredential
Oracle Secret Store Tool : Version 11.2.0.3.0 - Production
Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
Enter wallet password:
List credential (index: connect_string username)
2: TESTDB_STANDBY sys
1: TESTDB_PRIMARY sys
[oracle@orasvr3 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /@TESTDB_PRIMARY
Connected.
DGMGRL> connect /@TESTDB_STANDBY
Connected.
DGMGRL>
</pre>
<br />
Observer has been started and I begun failover tests. Here is a first attempt:<br />
<pre>12:09:25.21 Thursday, May 30, 2013
Initiating Fast-Start Failover to database "TESTDB_PRIMARY"...
Performing failover NOW, please wait...
Failover succeeded, new primary is "TESTDB_PRIMARY"
12:09:31.78 Thursday, May 30, 2013
12:10:47.91 Thursday, May 30, 2013
Initiating reinstatement for database "TESTDB_STANDBY"...
Reinstating database "TESTDB_STANDBY", please wait...
Operation requires shutdown of instance "TESTDB" on database "TESTDB_STANDBY"
Shutting down instance "TESTDB"...
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
Please complete the following steps and reissue the REINSTATE command:
shut down instance "TESTDB" of database "TESTDB_STANDBY"
start up and mount instance "TESTDB" of database "TESTDB_STANDBY"
12:11:06.36 Thursday, May 30, 2013
</pre>
<br />
Looks like Observer was unable to shutdown TESTDB_STANDBY database. This is typical error if there is no DGMGRL services registered in listeners but I was sure network configuration is fine as it was working perfectly fine when observer has been started with user and password in connection string. So this problem has to be related to Oracle Wallet only. There is a not well know switch for DGMGRL program to enable debug mode and have some more information about issue and I decided to use it. First of all I have started with switchover tests as there need this same interaction with starting and stopping instance like failover and are faster to perform.<br />
<br />
Here is a output with debug option enabled:<br />
<pre>[oracle@orasvr3 ~]$ dgmgrl -debug
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /@TESTDB_PRIMARY
[W000 05/30 12:25:02.04] Connecting to database using TESTDB_PRIMARY.
[W000 05/30 12:25:02.09] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
[W000 05/30 12:25:02.10] Broker version is '11.2.0.3.0'
Connected.
DGMGRL> switchover to TESTDB_PRIMARY;
Performing switchover NOW, please wait...
New primary database "TESTDB_PRIMARY" is opening...
Operation requires shutdown of instance "TESTDB" on database "TESTDB_STANDBY"
Shutting down instance "TESTDB"...
[W000 05/30 12:26:23.24] Connecting to database using (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGB)(INSTANCE_NAME=TESTDB)(SERVER=dedicated))).
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
shut down instance "TESTDB" of database "TESTDB_STANDBY"
start up instance "TESTDB" of database "TESTDB_STANDBY"
</pre>
It is trying to connect to TESTDB_STANDBY using following connection description<br />
<br />
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGB)(INSTANCE_NAME=TESTDB)(SERVER=dedicated)))<br />
<br />
but this one doesn't exist in wallet. Service <db_unique_name>_DBG is created by DMON process and it is registered in default listener or listeners specified in local_listener parameter.</db_unique_name><br />
I have added above connection string to Oracle Wallet and completed all manual steps before next try. Here is a output for second switchover run:<br />
<pre>[oracle@orasvr3 ~]$ dgmgrl -debug
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /@TESTDB_PRIMARY
[W000 06/06 12:50:31.01] Connecting to database using TESTDB_PRIMARY.
[W000 06/06 12:50:31.05] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
[W000 06/06 12:50:31.06] Broker version is '11.2.0.3.0'
Connected.
DGMGRL> switchover to TESTDB_PRIMARY;
Performing switchover NOW, please wait...
New primary database "TESTDB_PRIMARY" is opening...
Operation requires shutdown of instance "TESTDB" on database "TESTDB_STANDBY"
Shutting down instance "TESTDB"...
[W000 06/06 12:50:45.95] Connecting to database using (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGB)(INSTANCE_NAME=TESTDB)(SERVER=dedicated))).
ORACLE instance shut down.
Operation requires startup of instance "TESTDB" on database "TESTDB_STANDBY"
Starting instance "TESTDB"...
[W000 06/06 12:50:47.09] Connecting to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))).
ORA-01031: insufficient privileges
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up and mount instance "TESTDB" of database "TESTDB_STANDBY"
</pre>
Still there is manual step to do but this time database was shut down automatically, and Observer was unable to connect to start up database. There is other connection string<br />
<br />
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))).<br />
<br />
This one can be found here<br />
<pre>DGMGRL> show database verbose TESTDB_STANDBY;
Database - TESTDB_STANDBY
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
TESTDB
Properties:
DGConnectIdentifier = 'TESTDB_STANDBY'
ObserverConnectIdentifier = ''
LogXptMode = 'SYNC'
DelayMins = '0'
Binding = 'optional'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '10'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '0'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = 'a, a'
FastStartFailoverTarget = 'TESTDB_PRIMARY'
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
SidName = 'TESTDB'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/oralogs/arch/TESTDB'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = 'arch_%t_%s_%r.arc'
TopWaitEvents = '(monitor)'
Database Status:
SUCCESS
</pre>
It has been added to Oracle Wallet as well and now my wallet looks like this
<br />
<pre>[oracle@orasvr3 ~]$ mkstore -wrl /home/oracle/testwallet -listCredential
Oracle Secret Store Tool : Version 11.2.0.3.0 - Production
Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
Enter wallet password:
List credential (index: connect_string username)
6: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))) sys
5: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr1)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_PRIMARY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))) sys
4: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGB)(INSTANCE_NAME=TESTDB)(SERVER=dedicated))) sys
3: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr1)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=TESTDB_PRIMARY_DGB)(INSTANCE_NAME=TESTDB)(SERVER=dedicated))) sys
2: TESTDB_STANDBY sys
1: TESTDB_PRIMARY sys
</pre>
After manual completion of required steps I run switchover again and this time it completed without any errors
<br />
<pre>DGMGRL> switchover to TESTDB_PRIMARY;
Performing switchover NOW, please wait...
New primary database "TESTDB_PRIMARY" is opening...
Operation requires shutdown of instance "TESTDB" on database "TESTDB_STANDBY"
Shutting down instance "TESTDB"...
[W000 05/30 12:36:51.39] Connecting to database using (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGB)(INSTANCE_NAME=TESTDB)(SERVER=dedicated))).
ORACLE instance shut down.
Operation requires startup of instance "TESTDB" on database "TESTDB_STANDBY"
Starting instance "TESTDB"...
[W000 05/30 12:36:52.54] Connecting to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))).
[W000 05/30 12:36:52.58] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 363 Serial number: 5
ORACLE instance started.
[W000 05/30 12:36:54.81] Connecting to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))).
[W000 05/30 12:36:54.84] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
[W000 05/30 12:36:54.84] Broker version is '11.2.0.3.0'
alter database mount
Database mounted.
[W000 05/30 12:37:02.74] Connecting to database using (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orasvr2)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=TESTDB_STANDBY_DGMGRL)(INSTANCE_NAME=TESTDB)(SERVER=DEDICATED))).
[W000 05/30 12:37:02.77] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
[W000 05/30 12:37:02.78] Broker version is '11.2.0.3.0'
Switchover succeeded, new primary is "TESTDB_PRIMARY"
DGMGRL>
</pre>
<br />
Lesson learned:<br />
<ul style="text-align: left;">
<li>FSFO Observer can work with Oracle Wallet</li>
<li>3 entries are required per database, service name has to be set to : <db name unique>, <db name unique_DBG> and <db name unique_DGMGRL></li>
<li>DGMGRL entry can be checked in database configuration in Broker</li>
<li>DBG entry - use -debug mode if you can't find a proper connection string </li>
</ul>
Hope it will help you with DataGuard Observer configuration.<br />
<br />
regards,<br />
Marcin<br />
<br />
<br /></div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com1tag:blogger.com,1999:blog-7461233846321640962.post-11109052385951705602013-03-29T18:03:00.000+00:002013-03-29T18:03:05.235+00:00dbms_dnfs and clone.pl<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial,Helvetica,sans-serif;">If you are using to use dbms_dnfs to clone your database as described in MOS note 1210656.1 or on Tim's Hall blog - <a href="http://www.oracle-base.com/articles/11g/clonedb-11gr2.php" target="_blank">Direct NFS (DNFS) Clonedb in Oracle Database 11g Release 2 (Patchset 11.2.0.2)</a> and your database version is 11.2.0.3 there is one additional step which is not covered by clone.pl script and has to be done manually.</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">In 11.2.0.2 it was enough to run crtdb.sql and dbren.sql scripts generated by clone.pl but this is what happen when you will run dbren.sql on 11.2.0.3</span>
<br />
<pre>SQL> !cat dbren.sql
declare
begin
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSAUX_FNO-2_22o1pnm0' , '/u01/clone/ora_data_CLONE2.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSTEM_FNO-1_20o1pnjq' , '/u01/clone/ora_data_CLONE3.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-UNDOTBS1_FNO-3_23o1pnmp' , '/u01/clone/ora_data_CLONE4.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-USERS_FNO-4_21o1pnkt' , '/u01/clone/ora_data_CLONE5.dbf');
end;
/
show errors;
alter database open resetlogs;
drop tablespace TEMP;
create temporary tablespace TEMP;
SQL> begin
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSAUX_FNO-2_22o1pnm0' , '/u01/clone/ora_data_CLONE2.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSTEM_FNO-1_20o1pnjq' , '/u01/clone/ora_data_CLONE3.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-UNDOTBS1_FNO-3_23o1pnmp' , '/u01/clone/ora_data_CLONE4.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-USERS_FNO-4_21o1pnkt' , '/u01/clone/ora_data_CLONE5.dbf');
end;
7 /
begin
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01141: error renaming data file 2 - new file '/u01/clone/ora_data_CLONE2.dbf' not found
ORA-01110: data file 2: '/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSAUX_FNO-2_22o1pnm0'
ORA-17515: Creation of clonedb failed using snapshot file /u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSAUX_FNO-2_22o1pnm0
ORA-06512: at "SYS.X$DBMS_DNFS", line 10
ORA-06512: at line 2
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">
After that operation I found following errors in alert log</span>
<br />
<pre>Fri Mar 29 13:31:20 2013
ERROR: clonedb parameter not set. Make sure clonedb=TRUE is set
Fri Mar 29 13:31:20 2013
Signalling error 1152 for datafile 1!
Signalling error 1152 for datafile 2!
Signalling error 1152 for datafile 4!
Checker run found 4 new persistent data failures
</pre>
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Let's check parameter </span>
<br />
<pre>SQL> show parameter clone
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
clonedb boolean FALSE
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
<span style="font-family: Arial,Helvetica,sans-serif;">I have changed that parameter in init.ora and restarted instance. </span>
<br />
<pre>SQL> show parameter clone
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
clonedb boolean TRUE
SQL> begin
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSAUX_FNO-2_22o1pnm0' , '/u01/clone/ora_data_CLONE2.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-SYSTEM_FNO-1_20o1pnjq' , '/u01/clone/ora_data_CLONE3.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-UNDOTBS1_FNO-3_23o1pnmp' , '/u01/clone/ora_data_CLONE4.dbf');
dbms_dnfs.clonedb_renamefile('/u01/app/oracle/backup/data_D-TESTSE_I-4169104998_TS-USERS_FNO-4_21o1pnkt' , '/u01/clone/ora_data_CLONE5.dbf');
end;
7 /
PL/SQL procedure successfully completed.
</pre>
<span style="font-family: Arial,Helvetica,sans-serif;">Now it is working again so time to come back to other tests with cloning.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">regards,</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Marcin </span><br />
</div>
<span style="font-family: Arial,Helvetica,sans-serif;"><br /></span>
</div>
Marcin Przepiorowskihttp://www.blogger.com/profile/15133397892511680504noreply@blogger.com1