Friday, February 6, 2015


EXMAPLE : WITH USERNAME AND PASSWORD

NET USE \\10.10.10.X\emp_identification_letters /u:mosbah P@$$w0rd
NET USE \\10.10.10.X\Catalog /u:mosbah P@$$w0rd

robocopy /MIR D:\MWA_STORE\TENDERS_STORE \\10.10.10.X\Catalog
robocopy /MIR D:\MWA_STORE\EMP_IDENTIFICATION_LETTERS  \\10.10.10.X\emp_identification_letters
break


-----------------------------------------------------------------------------------------------------------------------
robocopy /MIR D:\MWA_STORE\TENDERS_STORE M
robocopy /MIR D:\MWA_STORE\EMP_IDENTIFICATION_LETTERS N
break
--pause
-----------------------------------------------------------------------------------------------------

synchronize using shared storage passing username and password for security issue
note : the task should run with user has permission to shared storage and local server


NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server2 Backups /user:.\sqluser P@$$w0rd
Robocopy "F:\Doc_Server2" "\\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server2 Backups"  /MIR /FFT /Z /XA:H /W:5
NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server2 Backups /delete


NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server1 Backups /user:.\sqluser P@$$w0rd
Robocopy "E:\Doc_Server1" "\\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server1 Backups"  /MIR /FFT /Z /XA:H /W:5
NET USE \\10.5.39.100\Backups\ARC_STORE_BACKUPS\Doc_Server1 Backups /delete






Monday, January 26, 2015

sql server shrink command

USE HOSPITAL_DB
 select name,recovery_model_desc from sys.databases
 ALTER DATABASE HOSPITAL_DB SET RECOVERY simple

 DBCC SHRINKFILE (CDCDataStore , 1)


 --get datafiles from database to use in shrinkfile dbcc command

SELECT file_id, name
FROM sys.database_files;

Monday, January 19, 2015

Temp Directory Delete Patch File Command

to delete temp directory files older than 2 days put the following command in .bat file 
and create scheduled task to run it every day once

forfiles -p  C:\Doc_Server_Temp\ -d -2 -c "cmd /c del @path"

where  C:\Doc_Server_Temp\ is the temp directory you want to delete its files.

Monday, January 5, 2015

Eclips Error : java was started by returned exit code=13 java 8

http://www.ashout.com/fix-java-started-returned-exit-code13-eclipse/


Eclips.ini file

-startup

plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326

--product

org.eclipse.epp.package.java.product

--launcher.defaultAction

openFile

--launcher.XXMaxPermSize

256M

--showsplash

org.eclipse.platform

--launcher.XXMaxPermSize

256m

--launcher.defaultAction

openFile

--launcher.appendVmargs

-vm
C:\Program Files\Java\jre8\bin\javaw.exe
-vmargs

-Dosgi.requiredJavaVersion=1.6

-Xms40m

-Xmx512m

Wednesday, December 24, 2014

sqldatasource select with argument then bind to dataview


 <asp:SqlDataSource ID="srcPaperTypes" runat="server" ConnectionString="<%$ ConnectionStrings:ODAC_ConnString %>" ProviderName="<%$ ConnectionStrings:ODAC_ConnString.ProviderName %>"
                     SelectCommand="SELECT        DOC_SER, DOC_NAME
FROM            SHR.DOCS_SCAN
WHERE        (SYSNO = 7)
AND DOC_SER=:DOC_SER">
                    <SelectParameters>
                        <asp:Parameter Name="DOC_SER" />
                    </SelectParameters>
                </asp:SqlDataSource>






--------------------------------------------------------------------
 srcPaperTypes.SelectParameters.Clear();
        srcPaperTypes.SelectParameters.Add(new Parameter("DOC_SER",TypeCode.String, papertype.ToString()));
        DataSourceSelectArguments args = new DataSourceSelectArguments();
        DataView DV = new DataView();
        DV = (DataView)srcPaperTypes.Select(DataSourceSelectArguments.Empty);
        if(DV != null)
        result = DV.Table.Rows[0]["DOC_NAME"].ToString();

Friday, December 19, 2014

sql server 2008 add shared network mapped drive to backup select screen UNC SQL SERVER

if you have shared folder or network drive and you need to access it from sql server management studio or add this path to backup plan
use this command

 EXEC xp_cmdshell 'net use y: \\sharedLoc /user:username psw'

ex
 EXEC xp_cmdshell 'net use Z: \\10.5.39.100\Backups /user:sqluser P@$$w0rd'



which Y is the name of network drive will appear in SSMS screen
sharedLoc  is location for shared folder such as \\10.10.10.5\x

username  : permitted user to access shared folder
psw    password needed for user to access the folder



-----------------------------------------
You need to enable it. Check out the Permission section of the xp_cmdshell MSDN docs:
-- To Add Backup Network Shared Location Run the Following Script
-- 1- Change show advanced Options to one
EXEC sp_configure 'show advanced options', 1;
GO
-- 2-Reconfigure
RECONFIGURE;
GO
-- 3-Enable command Shell 
EXEC sp_configure 'xp_cmdshell',1
GO
--4-Reconfigure Again
RECONFIGURE
GO
--**************************************************** if the following commands not working let it run using command prompt net use 
-- To Delete connection To Drive
--EXEC XP_CMDSHELL 'net use */delete   /persistent:yes'


-- set Drive Name and Network Location.
EXEC XP_CMDSHELL 'net use R: \\172.19.8.65\FileServer\Eservices\ServersBackups\SQLServerBackps\ProdDBsBackups /USER:MEDMWA\SQLESER $@l@dmin'