RSS
 

Archive for the ‘IT’ Category

Schedule APEX Network Backups

30 Jan

For reference -

This walk-through assumes you have APEX 4.1 Listener and Oracle 10G XE or greater installed. If not, reference the links above.

We will break this walk-through up into 4 sections:

  • Mounting a network share for the backup directory and configuring fstab
  • Configuring APEXExport to correctly talk to your database
  • Write a script to make sure your backup directories exist and export all of your applications
  • Configure a cron job to run the script twice a day 7 days a week

Mounting a network share for the backup directory and configuring fstab
Create local mount point
mkdir /mnt/backup

Create connection file
nano /etc/cifspw
username
password

Edit fstab
nano /etc/fstab
//server.domain.com/share /mnt/backup cifs exec,credentials=/etc/cifspw,uid=root 0 0

Mount the directory
mount /mnt/backup

Configuring APEXExport to correctly talk to your database

You must run APEXExport from the utilities folder where you installed APEX
cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex/utilities

Export the CLASSPATH
export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/ojdbc14.jar

APEXExport is run in the following syntax:
java oracle/apex/APEXExport -db localhost:port:SID -user schemaOwner -password yourPass -workspaceid workspaceID
port = 1521
SID = XE

schemaOwner can be found based on your version of APEX. If you are running 3.5 user = APEX_030500. If you are running 4.1 user = APEX_040100
Unlock user and set password through SQL*Plus as SYSTEM
SQL> ALTER USER APEX_040100 ACCOUNT UNLOCK;
SQL> ALTER USER APEX_040100 identified by yourPass;

workspace ID can be found from the SQL workshop utility
select workspace, schemas, workspace_id
from apex_workspaces;

Your APEXExport command should now run successfully by itself and look similar to
java oracle/apex/APEXExport -db localhost:1521:XE -user APEX_040100 -password yourPass -workspaceid 13541863513546

Write a script to make sure your backup directories exist and export all of your applications
Create a new script
touch apex_backup.sh
chmod a+x apex_backup.sh

The script I wrote creates a folder for the day of the week (Mon) and a folder in that folder for the time of day (AM/PM) since I want to backup 2 times a day 7 days a week. It then rolls over each week. The script performs the following steps.
1. Create variables for the backup directories
#/bin/bash

adir=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex/utilities
ddir=/mnt/backup/config/apex/backups/$(date +%A)
tdir="$ddir/$(date +%p)"

2. Make sure the working directory and path are correct
cd $adir
export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/ojdbc14.jar

3. Start the backup log and execute the APEXExport command
echo APEX Backup Started $(date) >> $adir/backup_log
java oracle/apex/APEXExport -db localhost:1521:XE -user APEX_040100 -password yourPass -workspaceid 13541863513546 >> $adir/backup_log

At this point the each application is exported in the form f101.sql f102.sql and so on (101 = application id).

4. Make sure backup directory is mounted
#Check if mount does NOT exist
if ! grep -qs '/mnt/backup' /proc/mounts; then
mount /mnt/backup
fi

5. Create backup directories
#Create backup directories
if [ ! -d "$ddir" ]; then
mkdir $ddir
fi
if [ ! -d "$tdir" ]; then
mkdir $tdir
fi

6. Move backups and copy logs to backup directory
#Copy backups and logs to backup directories
cp -f f*.sql $tdir
echo APEX Backup Completed $(date) >> $adir/backup_log
cp -f backup_log $tdir

So now that we know what each section of the code is doing here is the entire script:
#/bin/bash

adir=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/apex/utilities
ddir=/mnt/backup/config/apex/backups/$(date +%A)
tdir="$ddir/$(date +%p)"

cd $adir
export CLASSPATH=.:${ORACLE_HOME}/jdbc/lib/ojdbc14.jar

echo APEX Backup Started $(date) >> $adir/backup_log
java oracle/apex/APEXExport -db localhost:1521:XE -user APEX_040100 -password HDlsdkjHs -workspaceid 1316703665945575 >> $adir/backup_log

#Check if mount does NOT exist
if ! grep -qs '/mnt/backup' /proc/mounts; then
mount /mnt/backup
fi

#Create backup directories
if [ ! -d "$ddir" ]; then
mkdir $ddir
fi
if [ ! -d "$tdir" ]; then
mkdir $tdir
fi

#Copy backups and logs to backup directories
cp -f f*.sql $tdir
echo APEX Backup Completed $(date) >> $adir/backup_log
cp -f backup_log $tdir

Configure a cron job to run the script twice a day 7 days a week
Edit crontab as root
su
crontab -e

Add one job to run the script at 11:55am and another to run the script at 5:00pm
#APEXExport AM
55 11 * * * /root/apex_backup.sh >/dev/null 2>&1
#APEXExport PM
0 17 * * * /root/apex_backup.sh >/dev/null 2>&1

After a week you will have AM and PM backups for Mon – Sun.

 
No Comments

Posted in IT

 

Apple devices can’t access internet via SonicPoint

05 Aug

If you have an iPhone or an iPad that cannot access the internet through a SonicPointNDR you came to the right place. I had a SonicPointN and everything worked fine for all of our devices. I then upgraded to a SonicPointNDR and only the iPhone couldn’t access the internet. No matter what DNS settings or firewall rules I tried.

The trick is to disable Aggregation on the Radio settings. As soon as I did this and pushed the changes to my SonicPoints the iPhone was able to get online.

Here are the details from SonicWall on the known issue: https://www.fuzeqna.com/sonicwallkb/consumer/kbdetail.asp?kbid=8091

 
1 Comment

Posted in IT

 

FTP ls command hangs from Amazon EC2 host

07 Jun

Problem: When trying to list the contents of a directory on a public FTP server from a host in the Amazon EC2 cloud the FTP client hangs. This can be from using ls in command line or simply logging in with an FTP client like WinSCP and getting the error:

“Timeout detected.
Could not retrieve directory listing
Opening ASCII mode data connection for file list.
Error listing directory ‘/’.”

Solution: Amazon EC2 host are behind a firewall which requires passive FTP. Check a box in your FTP client to force passive mode or if using command line or scripts enter the command “literal pasv” before listing the directory contents as shown below:

C:\Windows\System32>ftp

ftp> open ftp.publicftpserver.com

Connected to ftp.publicftpserver.com
220 EFT Server 6.2.7 Build 05.03.2010.3

User (ftp.publicftpserver.com:(none)): youruser

331 Password required for youruser.
Password:
230 Login OK. Proceed.

ftp> literal pasv
227 Entering Passive Mode (10,201,1,53,18,114).

ftp> ls
200 Command okay.
150 Opening ASCII mode data connection for file list.
file1
file2
file3
226 Transfer complete. 62 bytes transferred. 62 bps.
ftp: 62 bytes received in 0.00Seconds 62.00Kbytes/sec.
ftp>

 
No Comments

Posted in IT

 

ILO2 Integrated Remote Console : “unavailable already in use by a different client”

09 May

To transfer an iLO2 advanced license from one server to another you simply get the license key from the old server:
- Administration (tab) > Licensing > Copy : License Key

Enter the key on the new server:
- Administration (tab) > Licensing > Enter: Activation Key

Now you need to remove the key from the old server. The easiest way I found is to SSH to the iLO address of the old server:
- SSH to old server iLO IP address
- Log in as Administrator : iLO password
- run the command: delete map1 license

You should get the reply:
hpiLO-> delete map1 license
status=0
status_tag=COMMAND COMPLETED
iLO license removed.

- exit

Test the Remote Console on the new server. If you get the error “unavailable already in use by a different client” you will need to enable Acquire.
- Remote Console (tab) > Settings > check the box: Remote Console Acquire – Enabled
- Apply
- Test integrated Remote Console
- If the error pops up click the button that says Acquire.

 
No Comments

Posted in IT

 

Test drive IE 10

25 Apr

Just one of those post that spawned because I was impressed with something I stumbled across and wanted to share it.

Download the IE 10 Developer Platform and check out some of the really cool demos: http://ie.microsoft.com/testdrive/Default.html

 
No Comments

Posted in IT