SQL Newbie - Maintaining An Off-site Database Copy
May 24, 2007
Hi,
I am very new to SQL Server and am just starting to look into replication as a possible solution to a problem I have. I have a local database which will be running on either MSDE or SQL Express 2005. I have a database on a webserver running SQL Server 2005 Standard which I wish to keep as an exact copy of the MSDE/Express one. If data is changed in the local db then I want the webserver db to be updated with this data, preferably as the change occurs, but it could be on an hourly schedule if required.
If data in the webserver db is altered then I do not wish for it to update the local db, but I would like it to be assumed that the change is erroneous and reset the item to whatever exists in the local db. In other words, should a table be erroneously dropped or something from the webserver db then the table would be recreated when it syncs with the local db (rather than propogating the change back to the local db and thus losing local data).
Basically I want the web db to be an exact mirror of the local db as often as possible. Given that the webserver is running SQL Server 2005 Standard and the local machine will be running either MSDE or SQL EXPRESS, is this achievable and what would be the best way of achieving it? Should I use merge replication or database mirroring? I have succeeded in getting 1-directional merge replication working by setting the webserver up as a publisher and distributor and setting up a push merge subscription on the local machine with an ExchangeType of 1. However, this won't correct the data in the web db if it is compromised until it is altered locally.
It crossed my mind that I could write a small application to utilise tablediff to compare each table in the DBs and get it to correct the web db if required on a regular basis. Would this be a silly approach?
I was wondering if there is a way to copy files from a network to an ip site where you would need to log in at. What I am trying to do is make a SP that would take all .csv files from the network drive and place them in the other ip address folder however you would need to use the login information.
Our database(s) are all over the place - no documentation - lot's ofrubbish and unused stuff.I'm managing a project focusing on data quality that covers codechanges, alterations to DTS packages, schema changes etc etc.What I'd like to do is see where the bit I want to change is beingused.that might mean what stored procs use a field and what sprocs use thatsproc.maybe it's which dts packages use a sproc (and again up thehieararchy)The list is a long one but basically I need to know what the effectsare of changes.Is there a tool out there that lets me navigate a database to thatlevel of detail - I understand something along the same lines isavailable for MS Access but I can't find it for SQL Server.Thanks
hi all, i am working on portal site where i have created 18 tables in on database, i dont know weather i am right or wrong . Should i continue with the same or create two tables one will be master and another will contain common fields. but if i will create one table for all then what will happend. please tell me what to do and why? asap please............ Thanks for spending ur valuable time for me.
What are the basic processes for maintaining an SQL SERVER 2005 Database? Is there a top ten list of things you should do periodically to all SQL SERVER 2005 databases?
Hi there I sorry if I have placed this query in the wrong place. I'm getting to grips with ASP.net 2, slowly but surely! When i try to access my site which uses a Sql Server 2005 express DB i am receiving the following error:
Server Error in '/jarebu/site1' Application.
Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Database 'd:hostingmemberasangaApp_DataASPNETDB.mdf' already exists.Could not attach file 'd:hostingmemberjarebusite1App_DataASPNETDB.MDF' as database 'ASPNETDB'.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
This is the connection string that I am using: <connectionStrings> <add name="ConnectionString" connectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;Initial Catalog=ASPNETDB;User Instance=True" providerName="System.Data.SqlClient"/> </connectionStrings>
The database is definitly in the folder that the error message relates to. What I'm finding confusing is that the connection string seems to be finding "aranga"s database. Is it something daft?
I set up DB mirror between a primary (SQL1) and a mirror (SQL2); no witness. I have a problem when I issue command:
alter database DBmirrorTest Set Partner = N'TCP://SQL2.mycom.com:5022'; go
The error message is:
The remote copy of database "DBmirrorTest" has not been rolled forward to a point in time that is encompassed in the local copy of the database log.
I have the steps below prior to the command. (Note that both servers' service accounts use the same domain account. The domain account I login to do db mirror setup is a member of the local admin group.)
1. backup database DBmirrorTest on SQL1
2. backup database log
3. copy db and log backup files to SQL2
4. restore db with norecovery
5. restore log with norecovery
6. create endpoints on both SQL1 and SQL2
CREATE ENDPOINT [Mirroring]
STATE=STARTED
AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)
FOR DATA_MIRRORING (ROLE = PARTNER)
7. enable mirror on mirror server SQL2
:connect SQL2
alter database DBmirrorTest
Set Partner = N'TCP://SQL1.mycom.com:5022';
go
8. Enable mirror on primary server SQL1
:connect SQL1
alter database DBmirrorTest
Set Partner = N'TCP://SQL2.mycom.com:5022';
go
This is where I got the error.
The remote copy of database "DBmirrorTest" has not been rolled forward to a point in time that is encompassed in the local copy
if i have a given database (a model) and i want to copy this database in the same database instance. Is it ok to copy the mdf and ldf file and attach the files with a new database name in the same instance.
I am wondering how some of you update your database once it is already been in use. So take for example you have a few tables and users can enter data into the site. Now suppose you either add tables to the db or you add fields to an existing table. I am using sql express 2005 and just want to copy the db over with the copy website but it would overwrite any data users entered.Is there any easy solutions or suggestions for this.Thanks
I am developing a web site with asp.net 2.0 and c#, using Visual Studio 2005 and Microsoft SQL Server 2005 ( I am still learning about these technologies and languages ). I transferred my web site files to a new computer. I created a empty SQL database called "SiteData.mdf", I stopped the SQL server and then I replaced this database with a previous one with the same name and already populated with data. I used this maneuver in order to avoid having to insert all data again. The web site works fine when running inside Visual Studio, however when I try to run it in its published format it gives this error message: Server Error in '/MA' Application. Cannot open database "SiteData" requested by the login. The login failed.Login failed for user 'CENTAURUSASPNET'. I also observed that inside the SQL Server Management Studio, in the database properties, it shows "ETHERASPNET" as User or Roles ( however "ETHERASPNET" was created using the old computer's name [ or should I say domain ? ]) but the permissions list correctly displays the new name "CENTAURUSASPNET". I think that I, probably, should create a new user using the name "CENTAURUSASPNET" because it would use the name of the new computer ( or domain ) and then I should delete the old user name. Actually I tried to do that but I get the message "An object named ‘CENTAURUSASPNET' cannot be found". So, 1) What should I do to get the database being connected with the published web site ( note: I am publishing it in my own computer for awhile ) ? 2) How do I create the new user name "CENTAURUSASPNET" ? 3) I also would like to know why the name of the database in the Server Explorer panel of VS appears as "centaurus.SiteData.dbo" -while- inside the Object Explorer panel of the SQL Server Management Studio it appears simply as "SiteData" ?
I am new to the internet field. Can anybody help me in administering the SQL database on the site. Are there any tools so that I can administer the database on the site straight from my PC??? If there, please tell the URLs so that I can refer them. And please tell me other issues which are involved in administering the database on site.
How can I maintain a parellel SQL server database on my PC?? How can I take backup from my site to the SQL database which is placed in my PC?? I want to keep backup of my database in my PC.
Hi All,Just wondered if i could ask you for some advice and help.I'm looking to write a site, and one of the functions of the site is to remind the user of a certain event at a certain time. I was wondering how i would do this? or if anyone has a working example i could use?Also I dont quite know what database to use...... would MySQL do the function i am after???? If so then no more problem lol If not what database would you recommend i use?ThanksDanny
I am developing a web site with asp.net 2.0 and c#, using Visual Studio 2005 and Microsoft SQL Server 2005 ( I am still learning about these technologies and languages ).
I transferred my web site files to a new computer.
I created a empty SQL database called “SiteData.mdf�, I stopped the SQL server and then I replaced this database with a previous one with the same name and already populated with data.
I used this maneuver in order to avoid having to insert all data again.
The web site works fine when running inside Visual Studio, however when I try to run it in its published format it gives this error message: ~~~~~~~~~~ Server Error in '/MA' Application. Cannot open database "SiteData" requested by the login. The login failed. Login failed for user 'CENTAURUSASPNET'. ~~~~~~~~~~~ I also observed that inside the SQL Server Management Studio, in the database properties, it shows “ETHERASPNET� as User or Roles ( however “ETHERASPNET� was created using the old computer’s name [ or should I say domain ? ]) but the permissions list correctly displays the new name “CENTAURUSASPNET�. I think that I, probably, should create a new user using the name “CENTAURUSASPNET� because it would use the name of the new computer ( or domain ) and then I should delete the old user name. Actually I tried to do that but I get the message “An object named ‘CENTAURUSASPNET’ cannot be found�. So, 1) What should I do to get the database being connected with the published web site ( note: I am publishing it in my own computer for awhile ) ? 2) How do I create the new user name “CENTAURUSASPNET� ? 3) I also would like to know why the name of the database in the Server Explorer panel of VS appears as “centaurus.SiteData.dbo� –while- inside the Object Explorer panel of the SQL Server Management Studio it appears simply as “SiteData� ?
Hi.Does anyone know any web site with common database models presented andexplained.Database models like calendar, adressbook, storehouse...Thnx in advance
I have contracted a webproject to be done. My client allready has a website. I need to create another website that replace the existing one with the new look. This is the problem. The old website has a Database that is associated with user registration & all other data of the company. So, I need to implement the same database to the new website which I am going to develop.
In this case, how can I start? can I add a SQL express databse to the new project and import the data while the development phase? or should I use a SQL server installed while developing the site?
Please give me an easy to understanable reply that I can deal with the old database?
I have a vb.net web page which I created (a shopping cart). I created this site using vb.net 1.1 and SQL 2000 on my laptop. On my laptop everything works properly, but when I tried moving it to GoDaddy (http://currahee3-506.org/px/default.aspx). In the code, each query to the SQL server is done using stored procedures. When you first go the page, a drop down is presented. When you select "Shirt" from the category drop down. A second drop down menu is then displayed and will let you select what type of shirt you are interested in purchasing. Select Polo Shirt Without Pocket. Upon doing so, I receive an error message:
Invalid object name 'tbl_LookupCategory'.Invalid object name 'tbl_pxProducts'.Invalid object name 'tbl_LookupColor'.Invalid object name 'tbl_LookupSizes'.Invalid object name 'tbl_pxQtySold'.Invalid object name 'tbl_pxImages'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'tbl_LookupCategory'.Invalid object name 'tbl_pxProducts'.Invalid object name 'tbl_LookupColor'.Invalid object name 'tbl_LookupSizes'.Invalid object name 'tbl_pxQtySold'.Invalid object name 'tbl_pxImages'.Source Error:
Line 143: sqlCommand.Parameters.AddWithValue("@str_ItemName", Trim(DDL_Items.SelectedItem.Text)) Line 144: Line 145: Dim dataReader As SqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection) Line 146: Line 147: dl_Description.DataSource = dataReader Source File: d:hostingcurraheepxdefault.aspx Line: 145 Keep in mind the Stored Procedure works in my testing environment, but not on GoDaddy. I moved the selected statement into a view on the GoDaddy SQL server, and the view worked perfectly. The tables do exist on the GoDaddy SQL Server. This is the Stored Procedure: CREATE PROCEDURE [dbo].[sp_GetItemInfo] @str_ItemName VarChar(50) AS SELECT TOP 100 PERCENTtbl_pxProducts.int_ItemID,tbl_pxProducts.str_ItemName,tbl_pxProducts.int_RetailPrice,tbl_pxImages.str_SmallImageURL,tbl_pxImages.str_MediumImageURL,tbl_pxImages.str_MediumImageBackURL,tbl_pxImages.str_LargeImageBackURL,tbl_pxImages.str_LargeImageUrl,tbl_pxImages.str_SmallImageBackURL,tbl_pxProducts.int_Quantity - tbl_pxQtySold.int_QtySold AS int_QtyAvailable,tbl_LookupCategory.str_Category,tbl_pxProducts.Int_SizeID,tbl_LookupSizes.str_Size,tbl_pxProducts.Int_ColorID,tbl_LookupColor.str_Color FROMtbl_LookupCategoryINNER JOINtbl_pxProductsONtbl_LookupCategory.int_CategoryID = tbl_pxProducts.int_CategoryIDINNER JOINtbl_LookupColorONtbl_pxProducts.Int_ColorID = tbl_LookupColor.int_ColorIDINNER JOINtbl_LookupSizesONtbl_pxProducts.Int_SizeID = tbl_LookupSizes.int_SizeIDLEFT OUTER JOINtbl_pxQtySoldONtbl_pxProducts.int_ItemID = tbl_pxQtySold.int_ItemIDLEFT OUTER JOINtbl_pxImagesONtbl_pxProducts.int_ItemID = tbl_pxImages.int_ItemID WHERE(tbl_pxProducts.int_Quantity - tbl_pxQtySold.int_QtySold > 0)AND(tbl_pxProducts.str_ItemName = @str_ItemName)
ORDER BYtbl_LookupSizes.str_Size Does anybody have any suggestions as to why this stored procedure is failing?
I have build a ASP.NET website with a login form. I can create an account but I am not able to login into the site. I have checked the connection string. I have changed the database folder and moved files around to get the database runing from a different folder but it still wont work.
I've downloaded a copy of Microsoft SQL Server Management Studio Express from MS. Can this product be used to query an SQL database at a web site. Conversely, is there a command line utility for running SELECT statement queries on my remote web site database?
Greetings,I am in the process of installing a SQL database at a customerlocation. I have determined that there are 3 ways to do this, and Iwanted to know which is the best of the 3.1 Install From Script.In this method I create the database and its objects in scripts thatare run via osql utility on the SQL server machine. For loading anyinitial data that I need in the database I also run bcp commands.2 Install from a backupIn this method I created an empty database on the SQL server, and thenrestore over it the database from a backup of the database that I needto deploy. Then I add or re-attach the users for the database. Iperform all of these operations using osql as well.3 Install by attaching the data files.In this method I created an empty database on the SQL server, and thenI attach the data files to the database using the sp_attach procedure.Then I add or re-attach the users for the database. I perform all ofthese operations using osql as well.Although it is no problem for me to use any of these methods, I wantedto know from you veterans out there what the best practices are. Andalso if there are any unseen hazards for each method above. Or if Iam totally off-the-target, and there is another method that is thepreferred way.Thanks in Advance,roger
I have been working with Visual Studio 2005 and the Personal Web Site Starter Kit. All is well and working. My problem is that after the database is updated (as in uploading photos and album creation) and the original web site is edited and republished, the web site database is overwritten and all the work is lost. What is the proceedure to either copy the web database to the development site on my computer so updates will not be lost, or a method of publishing that will not loose the up to date content on the web server? I would much prefer to be able to copy the database to my development computer as adding tables to the database is something that needs to be done. Any help on this would be appreciated.
Hello,There's information on my Internal SharePoint DataBase that I want to access. How can I do this? Could you help me or at least point me in the right direction.The information I am requesting is just text.Thank you,Mark
I have an sql script that I ran on my local system using osql. Itcreated all the tables, views, and even inserted sample data into thetables.Now I need to create that same database on a shared hoster site. Onlythe hoster does not allow the running of osql.How can I create my sql server database on my shared hoster site?Can I save and restore my database somehow?Is there a stored procedure I can run which will run the .sql scriptfile?thanks,-Steve
VWD 2005 Express. Visual Basic. Sql Server 2005. I am trying to establish a connection to a SQL database. The connection (and all other database reads and writes) work fine in debug and in "view in browser" from VWD. I am running the VWD on the same server that hosts the site. When on my server (Windows 2003 Server) under IIS, the connection attempt times out. Below is the code that is failing (only on the server when deployed): Private Shared Sub OpenConn(ByVal cmd As SqlCommand, ByVal Success As Boolean) Dim conn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("GoodNews_IntranetConnectionString").ToString) 'The connection string resolves to ("Data Source=HQSERVERHQSERVER;Initial Catalog=GoodNews_Intranet;Integrated Security=True" Try conn.Open() cmd.Connection = conn Success = TrueCatch ex As Exception Success = False End Try End Sub
I am trying to add a SQL Server 2005 Express Edition Database to my Web Site. But I am unablr to do so.
I am getting the following error: {"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"} I am unable to understand what exactly is the problem. Pls Help me out. Thanx In Advance.
I have installed SSRS 2012 Standard Edition in our DR site. We replicate over the reporting server databases over from our Production server via storage replication. It is on a different server than the reporting service. When I configure the SSRS in DR it is still seeing the SSRS from our Production server and tries to make it a scale out deployment which it is obviously not allowed to be because of the edition.Is there something in the database itself I need to change so it doesn't think the production server is still connecting?
Hello I am a software developer with minimal SQL server administration skills. Currently I am using SQL Server 2000.I need to know if there is a way to copy a particular table from a database, and to copy the table into a different database.Basically on a project I am working on we are using a table named "Customers" from a database named QTR. We need to copy this database table into a different database named "Research". How can this be done? Is if very complicated?
On my VWD 2005 Express, I have installed 2 SQL Server 2005 Express databases in the App_Data folder.I kind of remember these 2 databases were installed from Wrox web site or a zip file. Now we still useSQL Server 2000 databases for our ASP.net applications. I have downloaded the SQL Server 2005 Express.These 2 databases in the App_Data folder seem to work fine although I can not see them from theManagement Studio Express. My question is: How do I 'manually' create a new SQL Server 2005 database into the App_Data folder? TIA,Jeffrey
hi , i am working on an application using c#, visual studio 2005, sql server 2005. i have a few tables in sql server 2005. i need to save the history. (i.e) all the inserts, updates, and deleats performed on the tables. can any one suggest me how can i achieve that. should i use triggers and save the changes in another table ??? waiting for your suggestion?? thank you
Please what is the best way to perform index maintenance. I use 7.0 We have been having slow server performance, and one of the options is to do index maintenance. I have researched but could not get a clear picture of what I should do. Has anybody performed the same task before? Thanks for your help!!!
Hello Friends, Iam new to this sql server arena. I have implemented a procedure which does a series of insert and update statements and all of this statements must be implemented all at once or none. But if I got error in some statements , the rest of the statements are been executed. Please suggest me a way or code snippet to achieve atomicity in a sqlserver procedure.