Wednesday, 29 September 2010
Install Apex on Oracle XE database
Monday, 27 September 2010
Out-of-place upgrade
Hello Hemss,
I am trying to do an in-place-upgrade (replacing the old Oracle software completely because our test servers have only very little space). When you want to perform an out-of-place upgrade, things are more simple, but you need the disk space for a new Oracle home (about 6 GB on Linux-x64 in my case). Essentially, the steps are:
1. You can keep the production database online during the next steps
2. Install the new 11.2.0.2.0 into a new Oracle Home (an Oracle software directory which does not exist yet). Only install the software.
3. Apply any post-11.2.0.2.0 patches if available and needed
4. Schedule a maintenance window with your users
5. Put the original database(s) in MOUNT mode (SHUTDOWN IMMEDIATE followed by STARTUP MOUNT)
6. Perform a FULL backup of both database and old Oracle home, just to be on the safe side.
7. Set your enviromnent: ORACLE_HOME and ORACLE_BASE should point to your NEW installation, ORACLE_SID to your production database.
8. Start netca to create a new LISTENER for your new software installation (you might want to use a different port than your previous installation in case you need to run both at the same time)
9. Start dbua from the new Oracle Home and follow the on-screen instructions. You can either create an updated copy of the database (needs more disk space but you can easily switch back to your orginal DB), or you change the database to fit your new Oracle version (needs less space, but you need to run the scripts to downgrade to the old release if you need to go back)
So, as long as you have plenty of disk space, things are not that difficult at all. Of course, you should always read the release notes and the full installation guides for the new version because there might be new features or behaviours that affect your database. It is also highly advisable to test this on a completely different machine first.
You can find the complete upgrade guide here: http://download.oracle.com/docs/cd/E11882_01/server.112/e17222/toc.htm
Friday, 24 September 2010
Upgrade/Install Oracle Apex 3.2.1 to 4.0.1 on Oracle Database 10g,11g
1. Download APEX from OTN
2. Unzip it making sure you don't change the name of the apex folder inside the zip.
3. Connect to your XE installation
4. Run the installation script
5. Wait 10-15 minutes then connect again as sysdba and import images
!do not put the "apex" folder in the path there
That's it, no more unlock account, set password, set port, you already did this on the previous installation.
Enjoy!
*****************************************************************
To do fresh installation follow above steps plus these ::
sql > @apxconf.sql
Enter a password for the ADMIN user and you can change default Port[8080] if you want.
sql > ALTER USER ANONYMOUS ACCOUNT UNLOCK;
Now,login in browser http://127.0.0.1:8080/apex with following detail :
Workspace – internal
Username – Admin
Password – password entered in @apxconf.sqll
That's all!
Enjoy !
Other userful link
http://www.davidghedini.com/pg/entry/install_oracle_11g_xe_on
http://www.truexense.com/2013/03/how-to-upgrade-oracle-apex-41-to-421-on.html
Thursday, 23 September 2010
How to Configure APEX & the Embedded PL/SQL Gateway (EPG) in an 11G DB
Applies to:
Oracle Application Express (formerly HTML DB) - Version: 3.0.1 to 3.2
Information in this document applies to any platform.
APEX 3.0.1
How to Configure APEX & the Embedded PL/SQL Gateway (EPG) in an 11G DB
The 11g DB (11.1.X) comes with APEX 3.0.1 installed and requires just a few post-install
configuration steps:
Accomplish the following steps to configure the embedded PL/SQL gateway, specify APEX password, and unlock the ANONYMOUS account.
1. Change your working directory to $ORACLE_HOME/apex.
2. Start SQL*Plus and connect to the database where Oracle Application Express is installed as SYS.
For example:
ORACLE_HOME/bin/sqlplus /nolog
CONNECT SYS as SYSDBA
Enter the SYS password
3. Run apxconf.sql ->
4. When prompted, enter a password for the Oracle Application Express Admin account.
Make note of the password you enter, since you will use this password to log in to Oracle
Application Express Administration Services.
5. When prompted, enter the port for the Oracle XML DB HTTP server. The default port number is 8080.
Note:
Port numbers less than 1024 are reserved for use by privileged processes on many operating systems.
To enable the XML DB HTTP listener on a port less than 1024, such as 80, review the following
documentation:
· Refer to chapter "Using Protocols to Access the Repository" in Oracle XML DB Developer's
Guide for more information on using HTTP(S) and Oracle XML DB Protocol Server.
· Refer to chapter "Protocol Address Configuration" in Oracle Database Net Services Reference
for more information on protocol addressing.
6. Enter the following statement to unlock the ANONYMOUS account->
ALTER USER ANONYMOUS ACCOUNT UNLOCK;
At this time you should be able to log into apex as the admin user from a browser using -> http://machine.domain:port/apex
The machine is the DB host and the port is the one chosen in step 5.
If for some reason you can't log in, verify the EPG is up by running the following in your browser ->
http://machine.domain:port
If it's up, you should be prompted for a username and password for XDB.
Workspace – internal
Username – Admin
Password – passwd
If the EPG is not up, accomplish the following to start it:
1. Log in as SYS as SYSDBA
2.. Run the following statement:
EXEC DBMS_XDB.SETHTTPPORT(port);
Where port is the PLSQL Gatway port.
3. COMMIT;
For example:
EXEC DBMS_XDB.SETHTTPPORT(8080);
COMMIT;
Monday, 20 September 2010
How to Clear asm disk headers
dd if=/dev/zero bs=8k count=1000 of=/dev/sde1
[root@rac2 ~]# /etc/init.d/oracleasm querydisk -d /dev/sde1
Device "/dev/sde1" is marked an ASM disk with the label "DISK4"
[root@rac2 ~]# /etc/init.d/oracleasm querydisk -d /dev/sdb1
Device "/dev/sdb1" is marked an ASM disk with the label "DISK1"
[root@rac2 ~]# /etc/init.d/oracleasm querydisk -d /dev/sdc1
Device "/dev/sdc1" is marked an ASM disk with the label "DISK2"
[root@rac2 ~]# /etc/init.d/oracleasm querydisk -d /dev/sdd1
Device "/dev/sdd1" is marked an ASM disk with the label "DISK3"
[root@rac2 ~]# /etc/init.d/oracleasm querydisk -d /dev/sde1
Device "/dev/sde1" is marked an ASM disk with the label "DISK4"
[root@rac2 ~]# dd if=/dev/zero bs=8k count=1000 of=/dev/sde1
1000+0 records in
1000+0 records out
8192000 bytes (8.2 MB) copied, 0.460529 seconds, 17.8 MB/s
[root@rac2 ~]# oracleasm listdisks
DISK1
DISK2
DISK3
DISK4
[root@rac2 ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Cleaning disk "DISK4"
Scanning system for ASM disks...
[root@rac2 ~]# oracleasm listdisks
DISK1
DISK2
DISK3
Use the below command if you want to clear an ASM disk header. We may want to do that if we want to reuse the disk to add it to some other diskgroup.
$ dd if=/dev/zero of=/dev/raw/raw1 bs=8192 count=12800
12800+0 records in
12800+0 records out
104857600 bytes (105 MB) copied, 3.78717 seconds, 27.7 MB/s
Let us now verify the disk header..
$ kfed read /dev/raw/raw1
kfbh.endian: 0 ; 0x000: 0x00
kfbh.hard: 0 ; 0x001: 0x00
kfbh.type: 0 ; 0x002: KFBTYP_INVALID
kfbh.datfmt: 0 ; 0x003: 0x00
kfbh.block.blk: 0 ; 0x004: T=0 NUMB=0x0
kfbh.block.obj: 0 ; 0x008: TYPE=0x0 NUMB=0x0
kfbh.check: 0 ; 0x00c: 0x00000000
kfbh.fcn.base: 0 ; 0x010: 0x00000000
kfbh.fcn.wrap: 0 ; 0x014: 0x00000000
kfbh.spare1: 0 ; 0x018: 0x00000000
kfbh.spare2: 0 ; 0x01c: 0x00000000
$
KFBTYP_INVALID, indicates the disk headers are cleared. This disk should now appear as a CANDIDATE disk in the v$asm_disk.
Thursday, 16 September 2010
Secure Other Executables and DBSNMP
1.4 Secure Other Executables
Background
Take a look at the other executables in the $ORACLE_HOME/bin directory; some may look familiar, such as sqlplus or lsnrctl (the utility to start the listener); others may not.
Some of these files—such as tnslsnr, the utility that the listener process runs, or dbsnmp, which was used in Oracle Intelligent Agent—are not directly touched by the end user. To properly secure them, you must understand what they do and take appropriate action.
Recall that if the SUID bit is set for a file, then regardless of who runs the file it runs under the privileges of the owner, not the executor. You also learned that setting the SUID can be dangerous and should be discouraged.
There are several other files that have the SUID set to on. Let's find them.
$ cd $ORACLE_HOME
$ find . -type f \( -perm -2000 -o -perm -4000 \) -exec ls -l {} \;
In Oracle Database 10g Release 1 and later, the above should return only the following executables (Oracle Database 11g should return only a subset of this):
-rwsr-s--x 1 orasoft dba 93300507 Jul 22 11:20 ./bin/oracleO
-r-sr-s--- 1 root dba 0 Jul 1 23:15 ./bin/oradism
-rwsr-s--x 1 orasoft dba 94492 Jul 22 11:22 ./bin/emtgtctl2
-rwsr-s--- 1 root dba 18944 Jul 22 11:22 ./bin/nmb
-rwsr-s--- 1 root dba 20110 Jul 22 11:22 ./bin/nmo
-r-sr-sr-x 1 nobody nobody 58302 Jul 22 11:23 ./bin/extjob
Let's see what these files are:
Program | Description |
./bin/oracle | This file is a copy of the executable oracle. When you recompile the oracle executable using the relink command, the old copy is saved as oracleO. This is a potential security hazard; most DBAs ignore it, and it can be an avenue for hackers. Therefore you should take action to remove the permissions. The best option is to have no permissions for it to anyone other than orasoft: $ chmod 600 oracleO Now, if you check the permissions: $ ls -l oracleO |
./bin/oradism | Used for Dynamic Intimate Shared Memory. May be in use on your platform. May not be present in all cases. If present, leave as is. |
./bin/emtgtctl2 | Used for Oracle Enterprise Manager agent. There is no need for it to be set with SUID. The justification is the same as the oracle executable. Remove the permissions: $ chmod 0700 emtgtctl2 |
./bin/nmb | Used for Oracle 10g Grid Control agent to collect statistics on the target server. Leave as is. |
./bin/nmo | Used for Oracle 10g Grid Control agent to collect statistics on the target server. Leave as is. |
./bin/extjob | This is the executable for the EXTJOB (External Jobs, which allow you to execute OS-based programs from within Oracle Enterprise Manager). This is something you should be careful about. Do you use external jobs a lot? If not, then you should not even have this executable. In such a case, you can leave it in the directory but change the permissions and the ownership. The owner can be the Oracle software owner (orasoft, in our case), and the permissions should be rwx------: $ chown orasoft:oinstall extjob There may be another program present, extjobO, which was a previous compilation of the same program. Change the permissions of that too: $ chown orasoft:oinstall extjobO |
In Oracle9i Database Release 2, you will find a different file, ./bin/dbsnmp, which is the Oracle Intelligent Agent executable file. The permissions are set as such:
-rwsr-s--- 1 root dba 2986836 Jan 26 2005 dbsnmp
The problem with this file is that it needs root privileges to work properly, hence the SUID bit must be set to on. However, because this file is owned by root, hackers typically exploit it to gain access as root. The best advice is to eliminate it, or make it owned by the Oracle software owner and set the permissions to 700. You will lose some functionality, but it's worth it to eliminate the risk.
The other executable to consider is tnslsnr, which is the Oracle Net Listener. There are two executables:
• tnslsnr—the actual listener executable
• lsnrctl—the utility that is used to manage the listener, such as starting, stopping, and so on
If you look at the permissions:
$ ls -l *lsnr*
-rwxr-x--x 1 orasoft oinstall 214720 Oct 25 01:23 lsnrctl
-rwxr-xr-x 1 orasoft oinstall 214720 Oct 1 18:50 lsnrctl0
-rwxr-x--x 1 orasoft oinstall 1118816 Oct 25 01:23 tnslsnr
-rwxr-xr-x 1 orasoft oinstall 1118816 Oct 1 18:50 tnslsnr0
the files have execute privileges for all. Like the executable oracleO, when a new file tnslsnr is created by relinking the Oracle software, the existing file tnslsnr is renamed to tnslsnr0. This is done because if the process needs to be rolled back, the old executable can be copied over the new one. Because it's the copy of the old executable, the file tnslsnr0 may contain the same functionality as the original tnslsnr. The same goes for lsnrctl0.
Strategy
Now that you understand the purpose of each executable, let's see how you can secure your database infrastructure. Most of the strategy has been discussed in the above section on background information. So, in essence, your strategic moves are all these actions
- Remove all permissions to others from the files that are not needed—for example, lsnrctl0.
- Restrict permissions for executables to Oracle software only.
- Remove the SUID bit if the Oracle software owner starts the processes.
So, you want to change the permissions of the listener-related files as follows:
$ chmod 700 lsnrctl tnslsnr lsnrctl0 tnslsnr0
$ chmod 600 lsnrctl0 tnslsnr0
Verify the result:
$ ls -l *lsnr*
-rwx------ 1 orasoft oinstall 214720 Oct 25 01:23 lsnrctl
-rw------- 1 orasoft oinstall 214720 Oct 1 18:50 lsnrctl0
-rwx------ 1 orasoft oinstall 1118816 Oct 25 01:23 tnslsnr
-rw------- 1 orasoft oinstall 1118816 Oct 1 18:50 tnslsnr0
Implications
There are a few implications in this case:
- Changing the oracleO executable has no impact on the operation of the database. If you ever face an issue that points to a corrupt oracle executable, your best bet is to rename the oracleO file to "oracle." If you do so, make sure you reset to permissions to 700. The same goes for lsnrctl0 and tnslsnr0executables.
- Changing the emtgtctl2 permissions will have no impact if you use the Oracle software owner userid as the Oracle Enterprise Manager OS credentials. If you use a different userid (not orasoft, for example), the SUID must be reset to the old value and the permissions must be set as they were.
- The executable dbnsmp is used by Oracle Enterprise Manager Intelligent Agent, but only up until Oracle9i Database Release 2. Again, if you use the Oracle software owner as the OS credentials, there is no impact from changing the permissions. If you use a different userid, you must reset the permissions to the previous value.
Action Plan
- Change permissions of oracleO, tnslsnr0, and lsnrctl0 to 0600.
- Change permissions for tnslsnr and lsnrctl to 0700.
- Do you use external jobs in Oracle Enterprise Manager?
IF no THEN change the permissions of extjob to 0000
ELSEChange the permissions of extjob to 0700 and change the owner and group to orasoft and oinstall (or whatever the user and group of the Oracle software owner are).
END IF
IF you are on Oracle9i Database THEN
Are you using Oracle Intelligent Agent?
IF no THEN
Change ownership of dbsnmp to orasoft
Change permissions to 0700ELSE
No change needed
END IF
Note: If you apply a patch or upgrade the database, the permissions will be reset, so you need to re-examine them after the upgrade.
1.5 Change DBSNMP Password
Background
As you may know, Oracle Intelligent Agent communicates with Oracle Enterprise Manager to pass on information about components such as the database, the listener, and the server itself. To get data about the database, it needs to connect to the database using some userid. By default, the userid used is DBSNMP.When the database is created, the password of DBSNMP] is also set to dbsnmp. This user has some powerful privileges, such as UNLIMITED TABLESPACE, SELECT ANY DICTIONARY (which allows the user to select from dynamic performance views and data dictionary views), and ANALYZE ANY DICTIONARY (which allows analyze of the system objects). Many intruders use this userid and password for back-door entry into the database. Needless to say, this is a huge security hole.
Strategy
You have to change the password of this user to something other than dbsnmp. However, you can't just change the password at the database level, because that password is also stored in the agent configuration files. You need to update the configuration files to use the new password as well. Here's the procedure for Oracle Database 10g:- First change the password of the user DBSNMP to something else—for example, TopSecret:
SQL> alter user dbsnmp identified by topsecret;
- Go to the directory where the Oracle Agent Home is installed (not ORACLE_HOME)—for example, /u01/app/oracle/10.1/gridc.
- Go to directory <hostname>/sysman/emd , where <hostname> is the name of the host or server. For instance, if the name of the server is prolin1, then the directory should be prolin1/sysman/emd.
- Here you will find a file named targets.xml. Copy it under a new name (for example, targets.xml.old).
- Open the file targets.xml and search for the word "dbsnmp"; the contents should be similar to:
<Target TYPE="oracle_database" NAME="PROPRD1_prolin1">
<Property NAME="MachineName" VALUE="192.168.101"/>
<Property NAME="OracleHome" VALUE="/u01/app/oracle/10.1/db1"/>
<Property NAME="Port" VALUE="1521"/>
<Property NAME="Role" VALUE="NORMAL"/>
<Property NAME="SID" VALUE="PROPRD1"/>
<Property NAME="ServiceName" VALUE="PROPRD"/>
<Property NAME="UserName" VALUE="dbsnmp"/>
<Property NAME="password" VALUE="3797cf30e7c4a9c6" ENCRYPTED="TRUE"/>
<CompositeMembership>
<MemberOf TYPE="rac_database" NAME="PROPRD" ASSOCIATION="cluster_member"/>
</CompositeMembership>
</Target>
Note this line (in bold type, above):<Property NAME="password" VALUE="3797cf30e7c4a9c6" ENCRYPTED="TRUE"/>
This is where you will set the value of the password. Replace the above with<Property NAME="password" VALUE="topsecret" ENCRYPTED="FALSE"/>
Note that you changed the value of ENCRYPTED to FALSE.- If this is a RAC database, this line will occur twice in the file. Make sure you change both occurrences. Search the file for the word "password" to locate these two instances
- Now stop the agent by issuing this command
/u01/app/oracle/10.1/gridc/bin/emctl stop agent
Restart the agent:/u01/app/oracle/10.1/gridc/bin/emctl stop agent
When you restart the agent, the cleartext password in the configuration file is encrypted. If you check the above line in the targets.xml file again, you will see something similar to the following:<Property NAME="password" VALUE="3797cf30e7c4a9c6" ENCRYPTED="TRUE"/>
Note how the cleartext value has been converted to an encrypted value.- Now the agent is configured with the new password.
- If you use the standalone Database Console instead of Oracle 10g Grid Control, then the procedure is similar—except that in Step 2, you would go to ORACLE_HOME, not where the Agent Home is located.
Implications
There are no user implications here.Action Plan
1. Change the password of the user DBSNMP.
2. Update the agent files to reflect the new password.
Tuesday, 14 September 2010
Oracle Configuration Manager (OCM) Release 10.3 FAQ [ID 369111.5]
Oracle Configuration Manager (OCM) Release 10.3 FAQ [ID 369111.5]