Visualizzazione post con etichetta oracle. Mostra tutti i post
Visualizzazione post con etichetta oracle. Mostra tutti i post

giovedì 6 marzo 2014

PowerCLI: Automate Oracle DB install using Invoke-VMScript

I only recently discovered how cool and powerful is Invoke-VMScript, a VMware PowerCLI cmdlet that allows you to run scripts inside the guest VM operating system.
It requires VMware Tools installed and running inside the guest OS in order to successfully inject commands and scripts from the ESXi host to the VM and it is noteworthy to say that not all operating systems are supported by Invoke-VMScript cmdlet.
Supported ones, according to official documentation, are: Windows XP 32bit SP3, Windows Server 2003 32bit SP2, Windows Server 2003 64bit SP2, Windows 7 64bit, Windows Server 2008 R2 64bit and RHEL 5.

Invoke-VMScript syntax is:

Invoke-VMScript [-ScriptText] <String> [-VM] <VirtualMachine[]> [-HostCredential <PSCredential>] [-HostUser <String>] [-HostPassword <SecureString>] [-GuestCredential <PSCredential>] [-GuestUser <String>] [-GuestPassword <SecureString>] [-ToolsWaitSecs <Int32>] [-ScriptType <ScriptType>] [-RunAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Where:

HostCredential: username and password for the ESXi host on which resides the virtual machine.
GuestCredential: username and password for the guest OS. The user must have administrative access.
ScriptType: what kind of script you want to invoke: PowerShell, Bat or Bash.

In this article I provide a simple PowerCLI script which allows you to deploy virtual machines from a Win2008 R2 template and perform an automated silent install of Oracle Database 11g R2.

This is just an example of Invoke-VMScript usage and this only provides a software install, neither listener neither instance are configured. This script could also be readapted/improved for RHEL installs.

How this script works:

-Connects to a vCenter or ESXi host.
-Deploys "N" virtual machines from a properly prepared (read a few lines below to find how) Win2008 template.
-Power on the virtual machine.
-Perform a silent, fully automated, install of Oracle Database 11g R2 software by using Invoke-VMScript cmdlet.

Preprequisite for this PowerCLI script are:

-A Windows 2008 R2 virtual machine
-Oracle Database 11g R2 11.2.0.X. Unzip installation files on the Desktop. This script assumes that your installation directory is placed on: C:\Users\Administrator\Desktop\database
-Response file: a response file is a text file which is used by Oracle to perform silent installs. It contains all infos that usually are inserted by the user in a common GUI installation. This script assumes that your response file is: C:\Users\Administrator\Desktop\install.rsp

This is the content of my install.rsp response file.

 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0  
 oracle.install.option=INSTALL_DB_SWONLY  
 UNIX_GROUP_NAME=oinstall  
 INVENTORY_LOCATION=C:\Program Files\Oracle\Inventory\logs  
 ORACLE_HOME=C:\app\Administrator\product\11.2.0\dbhome_1  
 ORACLE_BASE=C:\app\Administrator  
 oracle.install.db.InstallEdition=EE  
 oracle.install.db.isCustomInstall=false  
 oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0  
 oracle.install.db.DBA_GROUP=dba  
 oracle.install.db.OPER_GROUP=dba  
 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false  
 DECLINE_SECURITY_UPDATES=true  

So, to recap: unzip Oracle DB installation files on the Desktop and place install.rsp in the same location as depicted by the following image.

Image


This is the PowerCLI code, as usual you can also find it on my GitHub repository: Invoking Scripts in Guest-VM.ps1



Run it and deployment of virtual machines from template begins:

Image


After script completion VMs are correctly added to vCenter Server inventory

Image


and Oracle Database is installed inside guest OS.

Image


To perform a full install of Oracle Database the listener and an instance must also be configured. This can be done using a response file and run using PowerCLI Invoke-VMScript.

If you need a standard listener configuration netca.rsp file provided in database\response installation directory does the job.

Listener silent install is performed by running:

 netca -silent -responseFile C:\Users\Administrator\Desktop\database\response\netca.rsp  

Similarly database instance can be added by invoking the Database Configuration Assistant (dbca) in silent install mode using a response file or passing all required configurations as parameters.

For example:

 dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orcl -sid orcl -gdbName orcl -memoryPercentage 30 -sysPassword welcome1 -systemPassword welcome1 -dbsnmppassword welcome1 -emConfiguration LOCAL -redoLogFileSize 100 -storageType FS -datafileDestination C:\app\Administrator\oradata -datafileJarLocation C:\app\Administrator\product\11.2.0\dbhome_1\assistants\dbca\templates -characterSet AL32UTF8 -sampleSchema false -totalMemory 512  

That's all!!

venerdì 3 gennaio 2014

VMware: Configure Oracle DB 12c for vCloud Director

With latest 12c release Oracle radically changed how databases are managed by introducing the concept of Pluggable Database. What's that? A pluggble database, or simply "PDB", is basically a database contained in another database which acts like a root container. This brings-in multitennancy capabilities in database without having to create a different instance for every tennant.

This new concept has slightly changed the way you perform tasks such as creating users, tablespaces and managing roles so I decided to come up with this post exaplaining how to set up an Oracle Database 12c for vCloud Director.

Prior to start please have a look at official vCloud Director Configure an Oracle Database documentation.

vCloud Director requires some tasks to be performed on Oracle Database:

-Create two tablespaces: CLOUD_DATA, CLOUD_INDX
-Create a user which will be using these tablespaces
-Assign certain permissions to this user
-Set up properly database initialization parameters

In Oracle Database 12c Enteprise Manager has been replaced by Enterprise Manager Express. An extremely slimmed-out version of 'ol classic EM.
Enterprise Manager Express is enabled by default only on root container and not on PDBs. After database installation completed a screen reported Enterprise Manager Express URL, which was something similar to this:

https://<IP_Address_or_FQDN>:5500/em

Where the port 5500 can be easily customized. For example in Oracle 11g by default it was port 1158.

Following screen depicts Enterprise Manager Express console for root container:

Image


As you can see Type reports ORCL as single instance database having 1 PDB, furthermore browsing upper screen menu no tablespace item exists. Tablespaces will be created in PDBs.

Despite all commands can be performed using SQL may be conforting having a GUI on which you can check if everything has been created/modified as expected so let's first enable Enterprise Manager Express on PDBs.

This is done issuing a SQL command so open SQLPlus and connect to database as sysdba.

 connect sys/<password>@<container> as sysdba  

SQL> connect sys/mypassword@ORCL as sysdba

Connected

To issue commands directly to PDB and not to root container you need to alter the scope of your SQL session. This can be done with following command:

 alter session set container=<PDB_name>;  

SQL> alter session set container=PDBORCL;

Session altered.


To enable Enterprise Manager Express console for PDB:

 exec dbms_xdb_config.sethttpsport(<EM_Port>);  

SQL> exec dbms_xdb_config.sethttpsport(5501);

PL/SQL procedure completed


EM console is now available even for PDB and as you can see here Tablespace menu item has appeared:

Image


Let's now perform vCloud Director's related configurations as reported in official documentation.

Tablespace creation can be done either via Enterprise Manager Express or by issuing SQL commands. If done via SQL ensure you are in the correct PDB scope:

 alter session set container=<PDB_name>;  

Create CLOUD_DATA and CLOUD_INDX tablespaces.

Edit $ORACLE_HOME variable according to your current home directory which in my case, on a Windows Server, is:

C:\app\Administrator\

 Create Tablespace CLOUD_DATA datafile '$ORACLE_HOME/oradata/cloud_data01.dbf' size 1000M autoextend on;  
 Create Tablespace CLOUD_INDX datafile '$ORACLE_HOME/oradata/cloud_indx01.dbf' size 500M autoextend on;  

Image


Create a new user who will access these tablespaces:

 Create user <vcloud_user> identified by <vcloud_user_password> default tablespace CLOUD_DATA;  

And assign to it the following privileges:

- CONNECT (already granted to default role)
- RESOURCE (already granted to default role)
- CREATE TRIGGER
- CREATE TYPE
- CREATE VIEW
- CREATE MATERIALIZED VIEW
- CREATE PROCEDURE
- CREATE SEQUENCE

This can be done either via SQL or via Enterprise Manager Express.

Image


Since vcloud user relies on default profile and will inherit default profile's attributes it could be a good move to change default password expiration lease of 180 days.

Image


Last but not least we need to size our database parameters according to the ones suggested by VMware in vCloud Director documentation.

- CONNECTIONS = 75*<Number_of_vCloud_Director_Cells>+50
- PROCESSES = CONNECTIONS
- SESSIONS = PROCESSES*1.1+5
- TRANSACTIONS = SESSIONS*1.1
- OPEN_CURSORS = SESSIONS


As usual this is feasible either via SQL or via Enterprise Manager Express.

If done via SQL synthax is the following:

 alter system set <parameter>=<value> scope=<memory_AND/OR_spfile> sid=<sid>  

For example:

alter system set open_cursors=500 scope=both sid='*';

will change open_cursors parameters to 500, this will apply to both memory (changes not consistent across reboots) and spfile (changes consistent across reboots) and will affect all instances, including nested PDBs.

Please bear in mind that some configuration parameters must be edited at root container level and cannot be modified at PDB level.

This is well shown using Enterprise Manager Express, as following image depicts, processes parameter cannot be modified at PDB level.

Image


Editing a parameter at both root DB or PDB using Enterprise Manager Express is really simple. Just go to Configuration -> Parameters, browse for the parameter you need to edit and click Set icon.

Image


That's all!!

martedì 29 ottobre 2013

Oracle OBIEE: Use Excel files as datasource

This post explains how to use Excel files as datasources for Oracle Business Intelligence repository.
As you know OBIEE supports a wide range of datasources to be imported in repositories and then processed for analytics. These comprise (well, obviously) Oracle Database, Essbase, SQL, and last but not least Excel.

To use Excel files as datasource a little modification is required to allow BI Administration Tool to properly recognize datasource tables and columns.

Let's pretend this is our source file.

Image

As you may notice there are 2 tables with 3 columns each.

ID_TBL1, FIELD1_TBL1, FIELD2_TBL1 for TABLE1
ID_TBL2, FIELD1_TBL2, FIELD2_TBL2 for TABLE2

To allow OBIEE to correctly recognize these tables and rows we need to define the sheet area dedicated to each one by dragging cell delimiter to the area of our interest, right clicking a cell within this area and select Define Name. Credits for this go to John Minkjan and his blog post.

Image

We then assign a name to the table. In this example I called it TABLE1.

Image

Repeat the same for TABLE2.

Image


Image

Then save the file and transfer it over to your BI server.

Now login to OBIEE server and install Microsoft Access Database Engine 2010 Redistributable. This component is needed in order to allow the creation of system DSN based on Excel sheets (actually a few Office files are supported, not just Excel).

This guide assumes you are running OBIEE instance on a Windows Server machine. Although this is also feasible under Linux I cannot show you how to import Excel datasource into the repository since AFAIK BI Administration Tool is available only in Windows BI version.

Once you are done copying Excel files over to OBIEE server let's now define our datasource by clicking Start -> Administrative Tools -> Data Sources (ODBC) -> System DSN tab

Image

Click Add -> Microsoft Excel Driver -> Finish

Image

Choose a name for your datasource (DATA_FROM_EXCEL in this example) then click Select Workbook, choose the previously created Excel file and click OK twice.

Image

Now Excel file is identified by the system as a proper datasource, so let's use it in OBIEE repository.

Open BI Administration Tool, load your existing repository if needed or simply create a new one, then click File -> Import Metadata

Image

Select datasource you created in the previous step (DATA_FROM_EXCEL in this example) and press Next.
Check only Tables type and press Next.

Image

Your tables will be correctly recognized and ready to be imported. Select what you need then press Finish.

Image

Tables, rows and data will be imported in your Physical Layer ready to be used for your analytics.

Image

That's all!!

lunedì 7 ottobre 2013

Oracle UCM: Searching content using logical operators

This post is about methods for content retrieval in Oracle WebCenter Content (formerly known as UCM) using common logical operators.
Searches among contents, as all of you know, can be performed using two search forms: Quick Search and Full Search. The thing that maybe not everyone knows is that both of them support the use of logical operators for content searches.

Quick search, as name suggests, is the quickest way for content search.

Image


Full Search is the search form displayed, by default, in the upper menu and it is the most complete solution for content retrieval infact it allows users to search against every metadata defined by the system administrator.
It can also be easily customized by using check-in profiles restricting users to search only against metadata that are significant for a particular document type.

Image

Methods for content retrieval can be applied to both Quick and Full Search and allow to increase the flexibility of your searches.

Here they are:


AND Operator:

Use: search_term_1 AND search_term_2

Equivalent to using SPACE between search terms:  search_term_1 search_term_2

Example: billing AND expenses

This returns all documents that contains billing AND expenses words.


OR Operator:

Use: search_term_1 OR search_term_2
Equivalent to using COMMA between search terms:  search_term_1, search_term_2

Example: billing OR expenses

This returns all documents that contains billing OR expenses words.


NOT Operator:

Use: search_term_1 NOT search_term_2
Equivalent to using MINUS between search terms:  search_term_1 -search_term_2

Example: billing NOT expenses

This returns only documents that contains billing word NOT documents containing expenses word.


MATCHES Operator:

Use: "search_term_1"

Example: "billing expenses"

This returns all documents that contains the exact billing expenses word.


Nested Operators:


Use: (search_term_1 [OPERATION] search_term_2) [OPERATION] search_term_x

Performs searches in the order specified by the parenthesis.

Example: (billing AND expenses AND june) NOT 2008

This searches first all documents that contains billing AND expenses AND june words then from all these documents it returns only the ones that does NOT contain the word 2008.

Note: By default Quick Search performs content retrieval against title, content ID, and full text. This behaviour, as Kyle suggests in his article, can be modified editing UCM configuration parameters (Administration -> Admin Server -> Server Configuration) by adding following line:

QuickSearchFields=dDocName|dDocTitle|dDocFullText|dDocAuthor|xYourCustomMetadata

Where xYourCustomMetadata is the name of your custom metadata you need to perform searches against. Obviously this line can be tuned according to your preferences if you for example want not to search among fulltext just remove it from configuration parameter.

QuickSearch search patterns can also be modified. Editing the same configuration as explained above you can customize them:

QuickSearchOperators=hasAsSubstring,hasAsSubstring,fullText,hasAsSubstring,hasAsSubstring,equals

That's all!!

domenica 18 agosto 2013

Oracle Database: PRVF-0002 Could not retrieve local nodename

If you encounter this error while installing Oracle Database 12c:

PRVF-0002 Could not retrieve local nodename

Image

Having a look at Oracle's error documentation it simply tells us:

Cause: Unable to determine local host name using Java network functions. 
Action: Ensure hostname is defined correctly using the 'hostname' command.

Here's how to solve it:

This is the standard file hosts

[root@vm1 ~]# nano /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


If you ever installed Oracle DB 11g you probably know you need to edit hosts file adding the current machine IP address and hostname. So file hosts resulted in something similar to:

[root@vm1 ~]# nano /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6 

192.168.116.230 vm1 vm1.localdomain

Unfortunately in Oracle DB 12c this is not enough, to solve the error above you need to point loopback address to the machine hostname.

[root@vm1 ~]# nano /etc/hosts

127.0.0.1   vm1 vm1.localdomain localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         vm1 vm1.localdomain localhost localhost.localdomain localhost6 localhost6.localdomain6 

192.168.116.230 vm1 vm1.localdomain

That's all!!

mercoledì 17 luglio 2013

Oracle UCM: DisableNtfs8dot3

If you have ever installed an instance of Oracle WebCenter Content on a Windows server you probably stepped into this error:


The weblayout directory is on a filesystem with 8dot3 semantics. Legacy 16-bit 8dot3 filenames conflict with revision labels and will cause file loss. Disable 8dot3 semantics by running "Installer DisableNtfs8dot3" and then restarting Windows.

Image



This can be solved in two ways:

1)Using Oracle suggested procedure

This is done running Installer.exe with DisableNtfs8dot3 parameter.

To do this open command prompt (Start -> Run -> cmd) and go to:


<DomainHome>\ucm\cs\bin\Installer.exe DisableNtfs8dot3


In my server it was:


E:\Oracle\Middleware\user_projects\domains\ecm_domain\ucm\cs\bin\Installer.exe DisableNtfs8dot3


2)Editing a registry key

Open regedit (Start -> Run -> regedit) and go to:

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/FileSystem

Edit NtfsDisable8dot3NameCreation key and change its value to 1 (default value is 2).


After this restart UCM instance (if you edit registry also a server reboot would be necessary) and alert message will disappear.

That's all!!

martedì 21 maggio 2013

Oracle UCM: Manually transfer files between servers


Some months ago I wrote a post about migrating content between UCM instances using the "Transfer" functionality of the Archiver applet.

This is a great functionality despite it requires that both UCM instances have set up an outgoing connection to establish communication. To set up an outgoing provider is really simple but to be recognized after it has been setup it requires a restart of UCM instance.

In this post I will explain how to manually transfer files between two UCM servers without requiring outgoing connections.

First step we need to create an archive on source instance that we will transfer over to target intance. Go to Administration -> Admin Applets -> Archiver -> Edit -> Add

Image

Image

Once created export you content by clicking Action -> Export (you can additionally create export maps if needed)

By not creating an outgoing provider this UCM instance is not aware of other UCM servers so we need to manually transfer archive over to the destination UCM instance.

To do this login using SSH to source UCM server and go to archive directory that you were prompted to choose during UCM installation and should be something similar to this:

/home/oracle/ucm/cs/archives/


So:

[oracle@ucm_source ~]$ cd /home/oracle/ucm/cs/archives/

In this folder you will have subfolder named after the archive name you selected in Archiver applet. In my case I created and archive called TestArchive so I have a folder called TestArchive.

We need to compress this folder and transfer it to destination UCM server.

[oracle@ucm_source archives]$ tar cvzf archive_file.tar.gz TestArchive

To perform transfer I use Secure Copy whose synthax is similar to this:

scp source_file.tar.gz <username>@<destination_ucm_server_IP>:/path_to_destination

In my case:

[oracle@ucm_source archives]$ scp archive_file.tar.gz [email protected]:/home/oracle/ucm/cs/archives/


Once file is transferred logout from source UCM and login via SSH to the destination UCM server.

[oracle@ucm_destination ~]$  cd /home/oracle/ucm/cs/archives/

In this folder you will find the source_file.tar.gz transferred from source UCM.

Let's untar it:

[oracle@ucm_destination archives]$ tar xvfz archive_file.tar.gz
Once uncompressd this file will automatically create a folder like in the source UCM server called "TestArchive" which contains all content transferred.

Next step we need to edit collection.hda file which tells UCM server what archives it need to present in Archiver applet and add our new archive.

[oracle@ucm_destination archives]$ nano collection.hda

<?hda version="11gR1-11.1.1.5.0-idcprod1-110413T184243" jcharset=UTF8 encoding=utf-8?>
@Properties LocalData
blFieldTypes=
IDC_Name=srvwcc16200
blDateFormat=M/d{/yy}{ h:mm[:ss]{ a}}!mAM,PM!tGMT+00:00
@end
@ResultSet Archives
2
aArchiveName
aArchiveDescription
TestArchive
This is a test
@end



Once done logout from SSH, go to Administration -> Admin Applets -> Archiver and you will see the manually transferred archive ready to be imported in your UCM instance.

That's all!!

giovedì 16 maggio 2013

Oracle UCM: customizing QuickSearch searches

QuickSearch is a really useful search tool in UCM because, as the word says, it allow to perform quick searches directly from every content server page just inserting search criteria and not going through the classic search form that searches content by filling certain metadata fields.

By default QuickSearch searches against dDocName, dDocTitle and dDocFullText, if enabled.

If you need to perform searches against other metadata you can easily customize it.

Go to Administration -> Admin Server

Image

Click General Configuration and insert:

QuickSearchFields=dDocName|dDocTitle|dDocFullText|xYour_Custom_Metadata

QuickSearchOperators=hasAsSubstring,hasAsSubstring,fullText,equals


Where:

QuickSearchFields are metadata fields against which searches are performed.
QuickSearchOperators are matching criteria for searches i.e. matches, hasSubstring.

Please note that every metadata inserted in QuickSearchFields field has corresponding search operator in QuickSearchOperators field.

Image


Once done restart your UCM instance.

If you like you can manually enter these configurations by adding them in /home/oracle/<your_ucm_directory>/cs/config/config.cfg

That's al!!

mercoledì 15 maggio 2013

Oracle UCM: Propagate metadata through folders

A basic task performed by UCM users is to create folders in the content server. Obviously in these folders there will be files and these files maybe should inherit some matadata from folders their are within. A problem that sometimes occurs is when folders are yet created and new metadata are added to the system. How can users modify folders metadata and propagate these metadata to child files and folders?

So...In this post I will briefly explain how to edit folders metadata and propagate these metadata changes.

Let's start saying that Folders_g component needs to be enabled in your UCM.

Propagation of metadata will affect child files and sub-folders contained in the folder itself. In this example I will update metadata of a folder named "D" so metadata propagation will affect both folders 2012, 2013 and all files contained in these two folders.

Image

In order to propagate metadata first step is to select which metadata you wish to propagate.

Go to Administration -> Folder Configuration -> Information Field Inherit Configuration and select all metadata you need to propagate.

Image 


Now let's edit some metadata from our (existing) "D" folder. Click the folder you need to modify metadata...

Image

...and choose Update.

Image

After all metadata are modified you can propagate all changes down the "folder tree"

Image

Please note that depending on how many content is stored "under" folders propagation process could take some time.
 
NOTE: As you probably noticed UCM doesent' have a folder structure as a common operating system.
It stores all contents in a "flat space" assigning a metadata to all files that are in a folder.
Metadata "FolderID" tells UCM that a file is contained in a certain folder. "FolderID" is automatically generated by UCM during folder creation, if not manually entered, and every folder has a unique "FolderID".
Folders themselves have "FolderID" metadata according to their position in the folder tree.
Top level folders have "FolderID" corresponding to the root folder which is Contribution Folders.

lunedì 6 maggio 2013

Oracle Database: Unlock user account via SQLPlus

As stated in "Oracle Database: Change Password Expiration" when installing DB I usually change password expiration for DEFAULT profile from 180days to UNLIMITED.

This is because if you create users that uses DEFAULT profile after 180days Oracle gives you:

ORA-28001: the password has expired

So...you can edit DEFAULT profile in two ways:

1) Via Enterprise Manager Console as stated in  Oracle Database: Change Password Expiration
2) Via SQLPlus

In this post I explain how to recover a locked user via SQLPlus and set DEFAULT profile with an unlimited password expiration time.

Connect to the instance:

[oracle@oracle ~]$ sqlplus

SQL> conn sys/password@sid as sysdba

SQL> select username,account_status from dba_users;  


The above command will return all dba users and their corresponding status presenting them in a view similar to this:

USER1 LOCKED&EXPIRED
USER2 OPEN 


Now let's unlock the user(s):

SQL> alter user [user_name] identified by [password] account unlock;

Then modify DEFAULT profile setting the password expiration time to UNLIMITED:

SQL> alter profile DEFAULT limit PASSWORD_LIFE_TIME UNLIMITED;

That's all!!

giovedì 4 aprile 2013

Oracle Linux: NIC bonding

NIC bonding allow the use of multiple NICs for increased network performance or availability. Multiple NICs are combined into a single "network entity" called bond in which NICs can be added or removed.

So, let's start:

Create the bond alias. This alias will point to a network configuration file where we will define the properties of our bond like the IP address and bonding options.

[root@oracle ~]# nano /etc/modprobe.conf

add the following line into modprobe.conf

alias bond0 bonding

Now create the configuration file for interface bond0:

[root@oracle ~]# cd /etc/sysconfig/network-scripts/

[root@oracle network-scripts]# touch ifcfg-bond0

[root@oracle network-scripts]# nano ifcfg-bond0


Insert this in ifcfg-bond0 file:

DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.0.0.0
NETMASK=255.255.255.0
IPADDR=10.0.0.122
USERCTL=no
BONDING_OPTS="mode=1 miimon=100"


Where:

NETWORK=10.0.0.0 is the network class we are using.
IPADDR=10.0.0.122 is the IP address of this machine
BONDING_OPTS="mode=1 miimon=100" are the bonding options.

mode=1 is used for active backup policy which means that only one network adapter is active and the remaining are waiting for main NIC to fail in order to replace it.
Common values for "mode" are: 0 round robin and 1 active backup
miimon=100 is the frequency in milliseconds of MII link monitoring. 100ms is a suggested value.

bond0 configuration file is completed, now we need to edit configuration files for all NICs participating into this bond. For this guide I'm using only two NICs in bond0 so I have to edit only ifcfg-eth0 and ifcfg-eth1


[root@oracle ~]# nano /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
HWADDR=00:50:56:BF:00:25
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no


[root@oracle ~]# nano /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
BOOTPROTO=none
HWADDR=00:50:56:BF:00:34
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no


As you can see we configure all interfaces of the bond to be slaves using bond0 as master.

Restart network to apply changes:

[root@oracle ~]# service network restart
As for last step we need to add a default gateway for our machine:

[root@oracle ~]# /sbin/route add -net default gw 10.0.0.250
Try to ping an internet address, if ping echo reply returns correctly make permament this route adding previous command to rc.local file.

[root@oracle ~]# nano /etc/rc.local

Add:

/sbin/route add -net default gw 10.0.0.250


rc.local will be called each time the machine will startup.


That's all!!

giovedì 24 gennaio 2013

Oracle Database: Schedule backups using exp

Despite I recommend taking backups using RMAN (Oracle Database: Schedule hot backups using RMAN) sometimes taking backups using EXP utility could be useful.

The main advantage of using EXP utility instead of RMAN is that the former (EXP) allows to take easy backups of specific tables and doesn't require the database to be in ARCHIVELOG mode to run.

Conversely RMAN it's faster than EXP because it doesen't require to examine every data block of the backup source, allow parallelized backups/restores, has a catalog for tracking backups, etc.

Set up EXP backups it's really simple, let's create a script which will be added to our crontab to perform EXP backups daily at 8PM.

I created a file called backup under /home/oracle with this content:

export DATE=$(date +"%m_%d_%y_%H:%M")

/u01/app/oracle/product/11.2.0/db_1/bin/exp username/password@instance_name file=/home/oracle/backup/backup_$DATE.dmp log=/home/oracle/backup/backup_$DATE.log statistics=none


First line creates a variable called DATE which is set as the current system date in month,day,year,hour,minute format.

Second line performs the backup calling EXP utility and passing following parameters:

username/password@instance_name tells EXP what to backup

file=/home/oracle/backup/backup_$DATE.dmp tells EXP where to save backup

log=/home/oracle/backup/backup_$DATE.log tells EXP where to save backup log

statistics=none tells EXP not to save statistics related to objects we are exporting

To schedule EXP backup using crontab:

[root@db1 ~]# crontab -e -u oracle

I will schedule backup everyday at 20:00 (8.00 PM)

00 20 * * * /home/oracle/backup

The first five fields are:

minute (0-59)
hour (0-23)
day of the month(1-31)
month of the year (1-12)
day of the week (0-6 with 0 = Sunday)

And the last parameter is absolute path to my backup script.

For more info on crontab have a look at crontab.org

NOTE: If you are unable to edit crontab file set EDITOR variable according to your preferred file editor.

In my case:

[root@db1 ~]# export EDITOR=nano

[root@db1 ~]# crontab -e -u oracle


That's all!!

mercoledì 23 gennaio 2013

JDeveloper: Deploy your project to an external WebLogic Server

JDeveloper by default uses it's internal WebLogic Server to deploy your projects.
When your project is completed presumably you will deploy your application to a production WebLogic Server.

In this post I explain how to create a deployment profile and deploy your project to an external WebLogic Server. I use the previously created SSXA webpage sample as reference but the procedure is the same for other applications like ADF ones.

First step is optional. I will change the default web context root name to a more easy one. By default JDev assigns web context root names like "You_App_Name-Project_Name-webapp" that will be used as root folder for project, this meas that the resulting url could be not so simple to remember.



Image


To change this name right click your Project in Application Navigator -> Project Properties -> Java EE Application and modify values as you like.

Image


So, let's start deploying our app.

Right click your app -> Deploy -> New Deployment Profile

Image


Select Deployment Profile -> WAR File

Image

Choose a name for your application and click OK twice on settings screens to use default settings.

Go to Application -> Deploy -> New Deployment Profile

Image

Under Deployment Profile select EAR File

Image


Under Application Assembly check your app then click OK

Image



Click OK again to following screen to use default deployment settings.

Finally go to Application -> Deploy -> YOUR_DEPLOYMENT_NAME

Image



Here you can choose between two deployment options:

1)Deploy to EAR file to be manually deployed to an external WebLogic Server

2)Configure an external WebLogic Server to allow JDeveloper to perform all tasks for you.

Option 2 is for sure the faster one just select Deploy to an Application Server and you will be prompted to configure an external WebLogic for deployments.

Image


In this post though I will follow option 1 performing a manual deploy.

Select Deploy to EAR

Image


Your EAR packaged application will be created somewhere on your hard drive, if you open Deployment tab in the bottom screen of JDev you will see a log containing where the file has been saved.

In my case my saving location is

C:\JDeveloper\mywork\Test_SSXA\deploy\application.ear

Login to your WebLogic Server that probably will have an URL similar to this:

http://weblogicserver_ip_address:7001/console

Click Deployments -> Lock & Edit -> Install
Image


Click upload your file

In Deployment Archive select your EAR file then click Next
Image



Click Next -> Next, then select the target you are deploying the application to: select AdminServer and click Next, choose a different name, if you like to, for your app then click Next -> Finish

Click Activate Changes

Image


Return to Deployment page, select your application, click Start -> Service all requests

Image



At this point your application will start servicing requests.

Go to:


http://weblogicserver_ip_address:7001/You_App_Name-Project_Name-webapp/appName/index.html

In my case:

http://10.0.0.4:7001/testSSXA/DemoSSXA/index.html


That's all!!