Tag Archives: Microsoft

Batch file running on command prompt but not in Microsoft window scheduler

Batch file running on command prompt but not in Microsoft window scheduler

Microsoft Scheduler not run the Scheduled task .bat file but working fine manually run.

I am created a job for rman backup scheduled and created bat file to execute it in Microsoft windows Scheduler. On running the .bat file manually it’s running successfully.
But when I scheduled it with windows scheduler its not running actually finished in 1 seconds as shown in windows scheduler history.

Followings all the steps I performed to solve my problem. I would guess that maybe some of these face same problem.

Solution:

1) Open the Task Scheduler of Microsoft Windows.
2) On General Tab, make sure the task is set to “configure for Windows Vista or Windows 2008” on the first page of the task properties.
3) On Action Tab, Open the Task Properties by click on “edit” Button at bottom, need to set the “start in” field with the folder location where the batch file located.
In the “Edit Action” Window there is a field for “start in (optional)” that you set to the path to the batch file.
Example:
D:\scripts\rman.bat is the my file for rman backup , then set “Start in (optional)” with D:\scripts value.
4) Make sure that the task is running as an account that has explicit “Full access” permissions to all these things: The .bat file itself, the folder containing the .bat file, and the target files/folders that are affected by the .bat script. Inherited permissions didn’t seem to work for me.
5) Make sure that the account running the task is a member of the local “administrators” group for this machine.
5) Make sure that the task is set to “run whether logged on or not”
6) The Task should run successfully with expected output when you right-click on the task and select “run”
If it does that then it will run successfully when you are logged off.

Advertisements

Migrate Database from Oracle to MS SQL Server with SSMA

Migrate Database from Oracle to Microsoft SQL Server with SSMA Utility

Following are the steps performed from migrate database from oracle to sql server:

1. Download the SSMA software for migration from Oracle to SQL Server

https://www.microsoft.com/en-us/download/details.aspx?id=54255

2. Install the SSMA software and found SSMA icon on Desktop by simple next next button.

SSMAicon1.JPG

3. Open the SSMA software and start a new project.
Go to File–>click New then Pop Window ask for project name, location and into which sql server want to migrate included SQL Azure option. (selected sql server 2014 for example)

SSMAnewproject.JPG

4. Connect with oracle database have three options:
1. Oracle Client Provider – Need to install Oracle Client
2. OLEDB Provider – Direct connectivity for database if not using PDB of 12c
3. ODBC Driver – Create ODBC connection first
Note: you are on another server or pdb database of 12c version.Its better to install Oracle client for connectivity and create TNS entries in Client.

In my example, My Server is in 12c and Schema is in PDB database. So i installed Oracle Client and configured PDB1 for direct connectivity. Make Sure your pdb is in open state.

Created TNS entry for PDB database in tnsnames.ora file:
Go to Oracle Client location $ORACLE_CLIENT_HOME\network\admin

tnsping.JPG

5. Connect with PDB1 database with SSMA Module in Oracle Connectivity:

PDBconnectivity.JPG

Note: it will take time after message of connected, it will start load the object from Oracle to make its own repository.

LoadOracleObjects.JPG

Error:
Connection to Oracle failed.
ORA-01033: ORACLE initialization or shutdown in progress

I am using PDB1 database , it is not in open state. So, I connected with sysdba user and open the pdb1 database
sqlplus sus@pdb1 as sysdba
Password
SQL> Alter database open;

6. After loading the Oracle Object, it will enable the connectivity button for SQL Server.

ConnectwithSQLServer

7. Connect with the SQL Server database.
Note: Choosed TEST database as name which is not present in SQL Server. So it will pop window for creating TEST database.

SqlServerconnection.JPG

Error: Sql Server Agent is now working. You need to start the service of SQL Server Agent in services.msc, Then press continue button.

SqlServerAgentService.JPG
Note: You can also modify reporserver schema in TEST Database to default dbo

Modifytodba.JPG

8. Right click on the schema in Oracle tab which want to migrate and choose create report.

CreateReport.JPG
Note: Process of creating report is started in output window.

9. Warning occured during the create report and continue on it.

Prerequestnotmet.JPG

10. After continue, it start converting and creating report in html fromat which is present in location of project –> report –> report –M mainindex.html

creatingreport

11. Report open in internet explorer which will give you detail of objects and estimate of manual convertion time.

Reporthtml.JPG

12. Start the convert process by right click on schema of Oracle and choose the convert button using the SSMA tool.

Conversionfinish.JPG

13. On Right tab SQL SERVER Metadata Explorer, Right click for sync the sql server database with repository
It will create the tables, procedure, function into the sql server database when you choose to sync the database.

synchronisedatabase.JPG

14. Syncronization is completed for sturcture

syncforstructure.JPG

15. Start the migration data process
Note: Both oracle and SQL Server database is selected in migration process

Startmigratedata.JPG
Note: Will ask for password again for data migration.

16. Datamigration report is finished.
Error 58 table failed to migrated

Datamigrationreport.JPG
Save the report for future correction.

17. Verify the sql server by connecting the TEST database.

Kill the hang service in window services.msc

Kill Window Service that hang on state “STOPPING” or “STARTING” in services.msc window

 
Suppose you are on services screen on window and you started the service by right click and start the service then it show status starting but does not respond beyond (means hanged state). Without restart the window machine you can kill the service by following commands from command prompt:
 
1. Check the service name with following command:

sc queryex OracleDBconsolePEGA
SERVICE_NAME: OracleDBconsolePEGA
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x2a
WAIT_HINT : 0x2710
PID : 94196
FLAGS :

2. It will give you the Pid of the services on which its running.
 
3. Kill service by taskkill command:

C:\>taskkill /pid 94196
ERROR: The process with PID 94196 could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).C:\>taskkill /pid 94196 /F
SUCCESS: The process with PID 94196 has been terminated.

  

msdtc.exe is causing lock/active on windows system

msdtc.exe is causing lock/active on windows system.

Issue: If you need to update any application on windows sometime we face the issue with active/locked file by windows services or process.

Solution:

C:\windows>tasklist /m oci*

Image Name     PID      Modules
============   ======   ========
explorer.exe   3136     oci.dll
vmtoolsd.exe   36108    oci.dll
msdtc.exe      6932     oci.dll


If you kill the PID process for msdtc.exe , it open again as shown below:

taskkill /pid 6932 /F
SUCCESS: The process with PID 6932 has been terminated.

C:\windows>tasklist /m oci*

Image Name     PID     Modules
============   =====   ========
explorer.exe   3136    oci.dll
vmtoolsd.exe   36108   oci.dll
msdtc.exe      23492   oci.dll


So, for fix it we need to stop the services for msdtc.exe process and disable it for the duration of our activity and then start it. Open the Services.msc of microsoft windows and find the following service and stopped or disabled it for during the activity, then start it.

Service name is Distributed Transaction Coordinator

6.JPG

Monitoringhost.exe caused active files during patching Oracle

During apply patch with opatch command, on windows we will get the following error:

Prerequisite check “CheckActiveFilesAndExecutables” failed

On Windows System, When you try to apply the Patch after clean shutdown.

Sometime following error occured:

Following files are active :
d:\oracle\product\11.2.0\dbhome_1\bin\oracommon11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\oraclient11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\orageneric11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\orapls11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\oran11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\oraxml11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\oci.dll
d:\oracle\product\11.2.0\dbhome_1\bin\orannzsbb11.dll
d:\oracle\product\11.2.0\dbhome_1\bin\oraasmclnt11.dll

INFO:Prerequisite check “CheckActiveFilesAndExecutables” failed.

OPatch failed with error code = 74
This is the common error occurred during the patch applied on window system.

One command is available for check which process is holdling lock on these files

Tasklist /m ora*

1

Solution:

Go to services.msc and paused the following service “Microsoft monitoring Agent” then it will work

2

Recall the message in Microsoft Outlook

Recall the message in Microsoft outlook 2010

Step 1. Open the outlook and go to the sent items mail on left side.

1

Step 2:  In Send items folder, Open the mail which need to recall and go to action as highlighted:

2

Step 3:  Select the recall the message

3

Step 4: Press Ok button for recall the mail.

4

Step 5: you will receive message that recall is successfully or failure status.

Note: if you recieved failure status its means recipients already read your message.

5

Temporary TEMP location Change in windows for avoid space error FTP process

Temporary Change TEMP Location in Windows platform for avoid insufficient Space error in C: Drive During FTP Process

In windows, when we do any operation like download, ftp etc, Due to insufficient space in C: Drive the we got error for insufficient space.

Suppose i created one batch file as ftp job which will transfer the backup of 16 GB files from Production Server to Test Environment daily. It’s start failed due to insufficient space but on D: drive on windows have sufficient space around 100 GB.

Error occurred due to environment variable TEMP is set to default C:\temp directory which is pointing to C: Drive which is not having sufficient space to do the operation then it will generate an error of insufficient space for operation.

Solution:
You can change the temp space location temporary for any task like ftp if d drive have enough space

set temp= D:\
set tmp=D:\

 
You can set this parameter temporary before the operation start for session level or used it in batch files for batch operation.