Connection to SQL Server over VPN

 

Get VPN connection IP address from IT server administrator
Set up VPN and login
Connect to SQL on local PC using SSMS or Visual Studio using SQL Authentication login and password
The server name to use in SSMS will be an IP address on the Network that you have used VPN to get to. You may or may not need to add \InstanceName.
It is not uncommon for this internal IP address system to be 10.0.0.x where x is the computer number
So format may be 10.0.0.x or 10.0.0.x\InstanceName

Special Cases
If the VPN internal IP address system uses 192.168.1.x then be careful that your local PC is not using 192.168.1.x
If it is then need to change the local PC IP address system to use 192.168.0.x

See Change IP address of a local (home) pc

ODBC connection to SQL Server 2008 R2

On ODBC  using SQL Native Client.
Many possible problems. But consider trying with Server Firewall off. If this is successful then consider the following changes on firewall which have worked for me.

Firewall settings on server are:

http://technet.microsoft.com/en-us/library/ms175043.aspx

  • On the Start menu, click Run, type firewall.cpl and then click OK.
  • In the Windows Firewall dialog box, click the Exceptions tab, and then click Add Port.
  • In the Add a Port dialog box, in the Name text box, type SQL Server <instance name>.
  • In the Port number text box, type the port number of the instance of the Database Engine, such as 1433 for the default instance.
  • Verify that TCP is selected, and then click OK.
  • To open the port to expose the SQL Server Browser service, click Add Port, type SQL Server Browser in the Name text box, type 1434 in the Port Number text box, select UDP, and then click OK.
    NoteNote
    To allow named pipes access through the firewall, you must also enable File and Printer Sharing through the firewall.
  • —————

    Also Firewall on server must add program SQLServer.exe which is at <program files><Microsoft SQL Server><MSSQL10_50.Instance Name\MSSQL\Binn\sqlservr.exe

    ————-

    Prefer not using older ODBC SQL server, but if do then on client configuration dynamically chosen ports is relevant

    Installing SQL Server 2008R2 on SBS 2008 Standard

    SBS Server Standard 2008 has SQL Server Management Studio Express tools on it.
    When installing SQL Server 2008 R2 Standard one of the checks was for the above and would not let you pass until this was removed. My approach was to uninstall SSMS Express. Checks then passed.

    As SBS is using SBSMonitoring as a database, websites suggest installing SQL Server as a new instance. I installed it as SQL2008 instance. SUCCESS.

    How do I … work with Guid in ADO.Net?

    How do I … work with Guid in ADO.Net?
    ( in this case to support SQL Server replication using dataset )

    26-Dec-2011
    Hypothesis: That DataSet could act unaware of replication column (do not import it on datatable creation) (or delete it after). Then use default in SQL Server (newsequentialid())
    Experiment: Worked out of the box – straight away

    During creation of SQL Replication, SQL Server will add a rowGuid column which is a uniqueidentifier and places a default of (newsequentialid()) onto this column
    Insert statements for replication must include all columns, except the rowGuid column.

    ERROR
    However if you then add a new row to this table in ADO.Net then program will give error message ‘Column rowGuid does not allow nulls’

    SOLUTION
    [MyDataTable].rowguidColumn.DefaultValue = Guid.NewGuid

    EXPLANATION
    SQL will have inserted a Unique index on rowGuid. However when the table is dropped onto the dataset the unique key is not there. Therefore although the above default set once will give each new row the same Guid, the ADO.net sees no errors. Because the insert statement does not insert the Guid, SQL does, then ADO.Net immediately returns the correct newly applied Guid from the database. This is because the Dataset insert statement also has a SELECT statement on it to get table updates immediately after the INSERT.

    SQL Server Replication

    Updating ERROR
    Updating columns with the rowguidcol property is not allowed.
    The transaction ended in the trigger. The batch has been aborted.

    Removed the rowguid column from the dataset update sql and it worked. Found no online instruction for this in short search.

    SQL Server Replication

    PUBLISHER
    SQL Server Agent account must be running on publisher
    Snapshot folder must be a UNC folder which is shared

    SUBSCRIBER
    Agent process account could be Subscriber Computer or Domain name \ User Name
    Distributer connection and Publisher connection I used a SQL Authentication account which will already work for normal login

    ERROR: On Subsciber
    Msg 14058, Level 16, State 1, Procedure sp_addmergesubscription, Line 381
    Cannot create the subscription because the subscription already exists in the subscription database. Only one subscription to the same publication is allowed in each subscription database. Drop the subscription and add it again if necessary. If the problem persists, replication metadata might be incorrect; see Books Online for troubleshooting information.

    SOLUTION: On Publisher
    SELECT * FROM sysmergesubscriptions
    DELETE FROM sysmergesubscriptions WHERE subscriber_server = ‘ServerName’

    ERROR: On Publisher
    Unable to start execution of step 2 (reason: Error authenticating proxy ComputerName\UserName, system error: Logon failure: unknown user name or bad password.).  The step failed.

    SOLUTION: On Publisher
    Agent Security use a windows account. Password is the windows password for that account.
    This account must have at least db_owner for the database being published.
    It must also have write permissions on the publication folder.
    http://msdn.microsoft.com/en-us/library/ms186515(v=SQL.105).aspx
    STATUS: Should now have files on Publisher in Snapshot folder

    ERROR: On Subsriber
    the schema script ‘….sch’ could not be propagated to the subscriber
    Go to subscriber view job history. Message in there may be above plus
    ‘The process could not read file ‘…\MSSQL\ReplData\unc\…’ due to OS error 3.

    SOLUTION: On Publisher
    Use a UNC path on the publication. To do this > Publisher > Publication > Right click properties > Snapshot > Put files in the following folder
    Then use \\ server or computer name \ .. \ MSSQL \ReplData or which ever folder
    Should now work

    Build server automated tests fail SQL authentication

    If unit tests are testing against the database using Integrated Security then when these automated tests are put onto the build machine authentication may fail.
    SOLUTION. Create a SQL login for a machine which is possible.
    CREATE LOGIN [MyDomain\MyComputer$] FROM WINDOWS;
    http://social.msdn.microsoft.com/Forums/en/sqlsecurity/thread/315b5780-c131-4867-88b9-ebac82e68d77

    SQL Server Agent will not start

    Believe this problem is because I had SQL Server 2008 on my machine and then added SQL Server 2008 R2. Today I had renamed the old MSSQL10 directories with a zz at front to mark them as old. Then SQL Server Agent did not start.
    First I had:
    Error message when you use SQL Server Configuration Manager to restart the SQL Server Agent service in SQL Server 2008:
    “The request failed or the service did not respond in a timely fashion”
    http://support.microsoft.com/kb/955494
    Suggested using Start > Administrative Tools > Services or Services.msc and start from there.

    This led to next problem
    The SQL Server Agent (MSSQLSERVER) service on Local Computer started and then stopped.  Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service.
    http://blogs.msdn.com/b/sqlserverfaq/archive/2009/06/12/unable-to-start-sql-server-agent.aspx
    Found that the registry entry
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\SQLServerAgent
    ErrorLogFile key was pointing at a location which was 2008 not 2008 R2
    Chnaged the key value and SQL Server Agent started OK

    SOLVED

    SQL Database Restore: Cannot access the specified path or file on the server

    “locate backup file cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists.

    If you know that the service account can access a specific file, type in the full path for the file in the file name control in the locate dialog box.”

    Solution:
    Start > Programs > SQL Server Conifguration Manager > SQL Server Services
    Find SQL Server in list and identify the Log On As account

    Then go to the backup file location and give permissions to that account. Should now work

    Changing the default location SQL Server Backup

     

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.2\MSSQLServer

    BackupDirectory key modify. Works

    http://www.mssqltips.com/tip.asp?tip=1583

    How to… Restore a deployed SSRS Report which has been deleted from VS-BI Studio

    http://www.go4answers.com/Example/possible-restore-deployed-reports-68366.aspx

    Yes, you can restore  .rdl file  from Report Manger. View your report, Click on Properties now click on Edit, This would create report defination file and would provide it for download. You can create a new report project  and add this report to your report project.