software:microsoft:sqlserver
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
software:microsoft:sqlserver [2017/11/28 07:43] – superwizard | software:microsoft:sqlserver [2018/09/13 20:28] (current) – superwizard | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== I can't connect to my servers SQL database via an IP Address ====== | ||
+ | |||
+ | From: https:// | ||
+ | |||
+ | < | ||
+ | open SQL Server Configuration Manager; | ||
+ | switch to the SQL Server Network Configuration | Protocols for SQLEXPRESS; | ||
+ | double-click the TCP/IP protocol; | ||
+ | select the Yes value in the Enabled field; | ||
+ | switch to the IP Addresses tab; | ||
+ | </ | ||
+ | |||
+ | ====== Backup with powershell ====== | ||
+ | < | ||
+ | ps1 script | ||
+ | Backup-SqlDatabase -ServerInstance Machine096\SSERVICES -Database IServices -BackupAction Database -BackupFile " | ||
+ | Exit | ||
+ | |||
+ | |||
+ | Cmd file | ||
+ | powershell.exe -executionpolicy bypass | ||
+ | -file " | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | From: https:// | ||
+ | |||
+ | < | ||
+ | I am not familiar with Python, but for your current requirement (i.e. backup). I'd strongly | ||
+ | recommend you to use PowerShell for two reasons: | ||
+ | |||
+ | MS in its SQLPS module (since SQL Server 2012), has a native cmdlet called | ||
+ | |||
+ | Backup-SQLDatabase | ||
+ | |||
+ | You may run this cmdlet on one central server to do the backup against multiple sql instances | ||
+ | at once because this Backup-SQLDatabase can accept multiple sql instances, like the following example | ||
+ | |||
+ | Backup-SQLDatabase -Database master -Server " | ||
+ | This 2nd point may help you to centralize all those backup scripts to one administration | ||
+ | server (dedicated for DBA use) instead of sparsely stored on each sql server instance. | ||
+ | |||
+ | Also with MS providing Backup-SQLDatabase, | ||
+ | all future new features. (For example, using this cmdlet to support Azure SQL Database etc.) | ||
+ | </ | ||
+ | |||
+ | ====== restoring SQL backup files to new filepaths ====== | ||
+ | |||
+ | From: http:// | ||
+ | |||
+ | < | ||
+ | Use RESTORE FILELISTONLY to get the logical names of the data files in the backup. | ||
+ | This is especially useful when you’re working with an unfamiliar backup file. | ||
+ | Example: | ||
+ | | ||
+ | FROM DISK = ' | ||
+ | |||
+ | Use RESTORE WITH MOVE to move and/or rename database files to a new path. | ||
+ | Example: | ||
+ | | ||
+ | FROM DISK = ' | ||
+ | WITH MOVE ‘ImportantDB’ TO ‘F: | ||
+ | MOVE ‘ImportantDB_log’ TO ‘G: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== sqlcmd - Backup and Restore Your SQL Server Database from the Command Line ====== | ||
+ | |||
+ | From: https:// | ||
+ | |||
+ | Also: https:// | ||
+ | |||
+ | < | ||
+ | |||
+ | sqlcmd -S < | ||
+ | |||
+ | SqlCmd -E -S Server_Name –Q “BACKUP DATABASE [Name_of_Database] TO DISK=’X: | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
====== How do I run a ps1 elevated as a scheduled job ====== | ====== How do I run a ps1 elevated as a scheduled job ====== | ||
From: https:// | From: https:// | ||
+ | |||
+ | VeryGood: https:// | ||
+ | |||
< | < | ||
- | powershell -File "c:\abc def\something.ps1" | + | powershell.exe -executionpolicy bypass -file "Set-PowerShellScript.ps1" |
On the system that the task will be run from, open the Windows Task Scheduler. This can be found | On the system that the task will be run from, open the Windows Task Scheduler. This can be found | ||
Line 85: | Line 170: | ||
< | < | ||
A. Full local backup | A. Full local backup | ||
- | The following example creates a full database backup of the MyDB database to the default backup location of the server instance Computer\Instance. Optionally, this example specifies -BackupAction Database. | + | The following example creates a full database backup of the MyDB database to the default backup |
+ | location of the server instance Computer\Instance. Optionally, this example specifies -BackupAction | ||
+ | Database. | ||
PowerShell | PowerShell | ||
Line 100: | Line 187: | ||
The topic also introduces SQL Server backup devices and backup media. | The topic also introduces SQL Server backup devices and backup media. | ||
</ | </ | ||
+ | |||
+ | ====== SQLBackupandFTP ====== | ||
+ | |||
+ | From: https:// | ||
+ | |||
+ | < | ||
+ | Run Differential and Transaction log backup | ||
+ | Full backups are available in all editions | ||
+ | </ | ||
+ |
software/microsoft/sqlserver.1511854997.txt.gz · Last modified: 2017/11/28 07:43 by superwizard