Showing posts with label CMD. Show all posts
Showing posts with label CMD. Show all posts

To take backup and restore sql express by cmd

By // No comments:
How to take backup of Microsoft SQL express by command prompt (CMD)?


Now going to share experience about that how to take backup and restore of Microsoft SQL express by command prompt (cmd). As we know about Microsoft SQL express edition it's totally free that's why it has limited feature. In Microsoft SQL express edition  have not feature to create job for backup. We have another option to take backup of Microsoft SQL express by command prompt (cmd).




To take backup of Microsoft SQL express :

SQLCMD -E -S Sql_instanceName –Q "BACKUP DATABASE [Name_of_Database] TO DISK='PathOfDestination\[Name_of_Database].bak'"



For Instance:

SQLCMD -E -S .\SQLEXPRESS -Q "BACKUP DATABASE TEST TO DISK='E:\Backup\test\test.bak'"





To restore backup of Microsoft SQL express :

SQLCMD -E -S Sql_instanceName –Q “RESTORE DATABASE [Name_of_Database] FROM DISK='PathOfDestination\[Name_of_Database].bak'"


For Instance:

SQLCMD -E -S .\SQLEXPRESS -Q "RESTORE DATABASE TEST FROM DISK='E:\Backup\test\test.bak'"



Hope this will help to all of you and resolved your all query if you have any query or question so you may ask to send email on our email account (onlinenetworkssolution@gmail.com) or leave comment on page.

To copy,cut and move folders or files from one location to another location

By // No comments:

How to copy,cut and move folders or files from one location to another location in window through command prompt?


There are some step which is used to copy,cut and move folders or files from one location to another location. when we used to copy or move to folders and files  from one location to another location then we see that our permission change by GUI mode whereas we have some command which help to keep all existing permission on different location.






To copy folder, Sub folder and files from one location to another location.

Step 1: Press window button and then type cmd after that you will see new window of Command prompt.

Step 2: Now type xcopy source location destination location /e then press Enter

                  xcopy C:\Users\pradeep.kumar\Desktop\test D:\Test /e

Successfully!!!!!  Now you will see that all the folders, sub-folders and files have been copying from one location and another location.



These switches have the following effects:

/E - To Copies folders and subfolders, including empty ones.
/H - To Copies hidden and system files also.
/K - To Copies attributes. Typically, Xcopy resets read-only attributes.
/O - To Copies file ownership and ACL information.
/X - To Copies file audit settings (implies /O).


XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
                           [/EXCLUDE:file1[+file2][+file3]...]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /A         To Copies only files with the archive attribute set,
               doesn't change the attribute.
  /M        To Copies only files with the archive attribute set,
               turns off the archive attribute.
  /D:m-d-y   To  Copies files changed on or after the specified date.
               If no date is given, copies only those files whose
               source time is newer than the destination time.
  /EXCLUDE:file1[+file2][+file3]...
               Specifies a list of files containing strings.  When any of the
               strings match any part of the absolute path of the file to be
               copied, that file will be excluded from being copied.  For
               example, specifying a string like \obj\ or .obj will exclude
               all files underneath the directory obj or all files with the
               .obj extension respectively.
  /P        To Prompts you before creating each destination file.
  /S        To  Copies directories and subdirectories except empty ones.
  /E        To Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /V        To Verifies each new file.
  /W       To Prompts you to press a key before copying.
  /C        To Continues copying even if errors occur.
  /I         To If destination does not exist and copying more than one file,
               assumes that destination must be a directory.
  /Q        To  Does not display file names while copying.
  /F         To Displays full source and destination file names while copying.
  /L         To Displays files that would be copied.
  /H         To Copies hidden and system files also.
  /R         To Overwrites read-only files.
  /T         To Creates directory structure, but does not copy files. Does not
               include empty directories or subdirectories. /T /E includes
               empty directories and subdirectories.
  /U        To  Copies only files that already exist in destination.
  /K        To  Copies attributes. Normal Xcopy will reset read-only attributes.
  /N        To  Copies using the generated short names.
  /O        To  Copies file ownership and ACL information.
  /X        To Copies file audit settings (implies /O).
  /Y        To  Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y      To  Causes prompting to confirm you want to overwrite an
               existing destination file.

  /Z        To  Copies networked files in restartable mode.