Monthly Archives: February 2014

Get-EventLog – Use Powershell to filter Event Logs

Use Powershell to locate the Errors from Event Logs on Servers

Powershell is indeed a powerful tool. But using it productively for the real world challenges is the key. With Powershell we can achieve a pro-active approach to IT Management within an organisation. Lets take a scenario; say we need to audit the servers regularly to check for System and Application Errors in the EventLogs

Open Powershell as an Administrator and type below command

Get-EventLog -Logname System -EntryType Error -Newest 5 -Computername Server1,Server2,Server3,Server4  | export-csv c:\plogs\errors.csv

Get-EventLog -Logname Application -EntryType Error -Newest 5 -Computername Server1,Server2,Server3,Server4  | export-csv c:\plogs\errors.csv

The above commands extract the latest 5 System and Application errors from the EventLogs of all the specified Servers. You can run this script through a Simple Task Scheduler for daily information

Advertisements

Powershell Error: ps1 cannot be loaded because running scripts is disabled on this system

Run the below command to enable running of scripts

SetExecutionPolicy -ExecutionPolicy Unrestricted -Force

If you are running from an 64-bit Machine, ensure you run this on both versions of Powershell including the x86 version

Backing up the Recovery Catalog – Oracle 10g / 11g

Your backup strategy is not complete until you ensure that your Recovery Catalog Database is also backed up. Use a simple batch file to automate this backup

set ORACLE_SID=<catalog_db_name>
rman target / NOCATALOG log C:\CatalogBackup.log APPEND cmdfile=c:\CatalogBackup.cmd

The backup metadata of the recovery catalog has to go to the Control File of the recovery catalog database; therefore you have to login to RMAN using NOCATALOG. Since RMAN Scripts work only when connected to the Recovery Catalog, you have to use an alternate operating system command file to automate the backup.

As illustrated above we have used the cmdfile  argument of RMAN to specify a custom cmd file. You can specify the RMAN Backup command within this file.

 

 

 

Copy and Paste in Powershell Command Window

A simple tip to save you time when using this powerful tool

  • Use the cursor to select the text
  • Press enter on the keyboard
  • Left Click on the Mouse/Keypad to paste the content

Master Sync has been disabled – Samsung Galaxy S6

If you have come across a scenario, where-in your email synchronization settings are active but yet you get the message Master Sync has been disabled

The below illustration will guide you through. You may also watch the video for the solution

From any screen, drag down the top portion of the Screen

S4 Screenshot

Click the Top Right Icon with 3 squares and a double arrow and you get the below screen as illustrated

Click the Icon titled Sync to enable it and you are done

S4 Screenshot

Create a Batch Script for Oracle RMAN Backup with Logging

You may want to run Oracle Backups using the regular Windows Task Scheduler. A simple batch file can be created for this purpose using below command. If you have multiple databases it would be wise to specify the ORACLE_SID

set ORACLE_SID=<targetdb>
rman target / catalog rmanuser/password@catalogdatabase script=<rman_script_name>

Example:  Target Database: orcl | Recovery Catalog Username /Password: rman/pwdrman | Recovery Catalog DB: rmandb

set ORACLE_SID=orcl
rman target / catalog rman/password@rmandb script=LEVEL1_BACKUP

Enabling Logging

To enable logging for your entire backup session, you can explicitly define it in the batch file itself, as illustrated below. The APPEND keyword ensures the file in rewritten in the next backup schedule.

rman target / catalog rman/password@rmandb log c:\TEMP\Oracle_backup.log APPEND script=LEVEL1_BACKUP

 

ORA-01950: no privileges on tablespace

Error from recovery catalog database: ORA-01950: no privileges on tablespace ‘SYSTEM’

ORACLE error from recovery catalog database: ORA-01950: no privileges on tablespace ‘SYSTEM’ | RMAN-06433: error installing recovery catalog

Please ensure you have assigned below minimum privileges to the User for your Recovery Catalog. Grant these by logging into your SYS user

  • GRANT resource to <recovery catalog username>
  • GRANT RECOVERY_CATALOG_OWNER to <recovery catalog username>

 

Cannot adjust brightness on a Lenovo Ideapad Z400 after installation of Windows 8.1

300x75_52930061bbfad.gif

After the installation of Windows 8.1, I had noticed  that the brightness of the laptop went down considerably low. Even by increasing or decreasing the brightness (F11 and F12) situation did not improve. The solution is a simple one. One just needs to re-install the graphic drivers and upgrade the Lenovo power management.

Alternatively one can simply visit the official forums of Lenovo about this particular issue.

300x75_52930061bbfad.gif

Creating a Recovery Catalog in a database different from Target Database

Applies to Oracle 10g / Oracle 11g

  • Create a new database using Oracle Universal Installer or from command line; lets say the new database name is orcl01
  • Once completed you will now have 2 ORACLE_HOME
  • In command prompt; set the ORACLE_SID=orcl01
  • Create a new tablespace say; rcatab. Please ensure you have set the db_create_file_dest parameter appropriately

CREATE TABLESPACE rcatab DATAFILE 1024M

Note: Define the space for your recovery catalog as per your database needs
  • Create a User which will be the owner of the recovery catalog
CREATE USER rman IDENTIFIED BY password
TEMPORARY TABLESPACE temp
DEFAULT TABLESPACE rcatab
QUOTA UNLIMITED ON rcatab;

GRANT RECOVERY_CATALOG_OWNER TO rman;
  • Connect to RMAN with the RMAN user and create the catalog
RMAN catalog rman/password@orcl01
CREATE CATALOG;
  • Register the Target Database with the Recovery Catalog
    • Before you do this; exit RMAN and set the ORACLE_SID to your target database
    • Login to RMAN connected to Recovery Catalog and Target Database
RMAN target / catalog rman/password@orcl01
Register Database;

Copying Outlook Folder Structure to another Outlook PST File

Applies to Outlook 2003/ Outlook 2007 / Outlook 2010 / Outlook 2013

You may have been using an Outlook PST with several folder structures in both Inbox and Sent Items. You may want to start with a new PST since the old one is getting bulky; but want all the previous PST folder structures duplicated in the new one. If you have built up a comprehensive list; creating one from scratch is tedious.

You may find a solution to your problem through different methods; but below is the easiest and most quickest way to achieve your requirement

Below Illustration is from Outlook 2010

  • File – Cleanup Tools – Archive
  • As illustrated; select the PST folder containing the folder structure you want duplicated
  • Under Archive Items Older than; select a date value which is before the time any email was stored in the selected PST.
    • For example: If you Current PST has email stored from Year 2008 to Year 2013; set the Archive Items Older than date field as 01/01/2008
  • Under Archive File; select directory location and filename for your new pst file.
  • Click Ok and your New PST file with only the folder structure will be created within the shortest possible time than any other solution can promise

 

  • outlook_archive