Dropping A Database That Subscribes For Replication
Nov 2, 1999
I am trying to delete a database that currently subscribes for replication. The problem however, is that the publishing server no longer exists and I can't disable the subscription therefore I can't drop the database. When I try to disable the replication the server tries to communicate with the old server. Is there anyway to force the dropping of the database or to force the server to disable replication.
thanks in advance
Michael
View 2 Replies
ADVERTISEMENT
Nov 22, 2002
I'm new to replication and would like to know how to drop an article published for replication. I believe I need to follow these steps, but I am unsure.
Step (1)
exec sp_dropsubscription @publication = N'db name',
@article = N'article name',
@subscriber = 'subscriber name',
@destination_db = N'db name'
Step (2)
exec sp_droparticle @publication = N'db name',
@article = N'article name'
Step (3)
drop the article on the publisher
Step (4)
drop the article on the subscriber
Is this the correct sequence or am I missing something.
Thanks, Dave
View 2 Replies
View Related
Jan 14, 2006
I am working on establishing a merge replication process between SQL Server 2005 and SQL Mobile 2005. I started with a new SQL Server 2005 instance and went through the Sample for SQL Mobile merge replication. So far so good.
Today, I tried to drop all support for replication on my current SQL 2005 test instance, so that I can start from a fresh instance and do another. I used Management Studio to drop all publisher and distribution settings and had several errors occur, where some roles were not allowed to be dropped because they had membership in them.
I dropped all the users that I added to the SQL logins and tried again.
Now I am trying to run the following script:
use AdventureWorks
exec sp_replicationdboption @dbname = N'AdventureWorks', @optname = N'merge publish', @value = N'false', @ignore_distributor = 'true'
-- Dropping the distribution publishers
exec sp_dropdistpublisher @publisher = N'XP-MIKED-LAPTOP'
GO
-- Dropping the distribution databases
use master
exec sp_dropdistributiondb @database = N'distribution'
GO
/****** Uninstalling the server XP-MIKED-LAPTOP as a Distributor. Script Date: 1/14/2006 2:16:29 PM ******/
use master
exec sp_dropdistributor @no_checks = 1, @ignore_distributor = 1
GO
The error I am getting from the first batch (sp_replicationdboption) is this:
Msg 208, Level 16, State 1, Procedure sp_MSmergepublishdb, Line 103
Invalid object name 'dbo.sysmergesubscriptions'.
To me it looks like all the publication objects have been already removed from AdventureWorks, but in sysdatabases, the category column still says 4 (merge publication). Since I can't just do this anymore:
UPDATE MASTER.DBO.SYSDATABASES
set category = 0
where dbid=8
I just don't know what I can do at this point. I can't even create a new publication in AdventureWorks because it thinks there is a sysmergepublications table in there and fails when there isn't.
View 3 Replies
View Related
Jan 19, 2007
For SQL 2005 transactional replication I have 1400 articles (tables, views, functions, sp) that are all replicated.
Will SQL 2005 allow me to drop a table from from the publication and drop it from the publication database that is referenced by exising views or sps that are replicated or does it somehow check that?
Linda
View 1 Replies
View Related
Oct 2, 2015
I am trying to drop a primary key on column LID and then create a clustered index on a new identity column ID and then add the primary key back on the LID. I am not able to do so due the table being in replication. here is the error:
Cannot alter the table '' because it is being published for replication.
How do I get past the error and create the Clustered Index on ID column in both publisher and subscriber?
View 2 Replies
View Related
Dec 21, 1998
Hi,
After I drop the database, I backed up the master database, I recreate the database with new name. When I tried to do the import on the command level,
It gives me the error:
Attempt to locate entry in the sysdatabases for database 'db1' by name,
failed -- no entry found in that name.
What should I do? Thanks.
View 1 Replies
View Related
Sep 7, 2007
Hi friends,
How I can drop a database insatance from a different server ( data base is SQL Server 2005) from my code
Hoping a early reply ....
Thanks :)
View 5 Replies
View Related
Jan 16, 2008
I am trying to run a dymanic DROP DATABASE <dbname> command in a stored procedure called from ASP.NET. I typically connect from the .net using a SQL builtin account. I am getting this error:
System.Data.SqlClient.SqlException: Cannot drop the database 'db_testco', because it does not exist or you do not have permission.
The database is there for sure asI can browse it via the Studio manager. What permission do I need to set for my .net login to allow it to drop ? I tried adding the Delete permission to the database and still no go...
Setup: SQL 2005 SP2 2 Node cluster.
Thanks.
View 3 Replies
View Related
May 2, 2000
i would like to drop a distribution database after disabling both susbscriber and publisher .but i get a message saying distribution database is still in use .and as far as i can tell its there is no one using it .also stopped sql agent but no luck . and when i do select @@ servername i get servername is null how do i correct it .
thanks
View 1 Replies
View Related
Dec 23, 1999
Is there a way in SQL to drop any users from a database. I am trying to schedule some nightly DB maintenance and some users are still in there sometimes. I need to be able to kick the out to do dbcc checkdbs, etc. Is there a way for me to do this without stopping the SQL services?
View 3 Replies
View Related
Apr 26, 2006
Hi,
i have a problem dropping a database?
I have a WinForm and i can create DB, create the Tables and drop the DB via buttons.
When i start myProgram it's no problem to drop the Database.
Then i can create the database without problems.
The tables also without problems.
Now if i try to drop my whole DB, i get the error message:
SqlException Handle :System.Data.SqlClient.SqlException: Cannot drop database "XtmsDb" because it is currently in use.
The code for dropping db:
public void deleteProjectDB()
{
conn.ConnectionString = "Data Source=TURM21;Initial Catalog=master;Integrated Security=SSPI;";
sqlStr = "Drop database XTmsDB";
try
{
System.Console.WriteLine("Opening Connection...");
conn.Open();
System.Console.WriteLine("Connection opened!!!");
SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
System.Console.WriteLine("Database dropped!!!");
}
catch (SqlException dropEx)
{
System.Console.WriteLine("SqlException Handle :{0}", dropEx.ToString());
}
finally
{
conn.Close();
System.Console.WriteLine("Connection closed!!!");
}
}
The code for creating db:
public void createProjectDB()
{
conn.ConnectionString = "Data Source=TURM21;Initial Catalog=master;Integrated Security=SSPI;";
sqlStr = projectDBStrings.getDBCreateString();
try
{
System.Console.WriteLine("Opening Connection...");
conn.Open();
System.Console.WriteLine("Connection opened!!!");
SqlCommand cmd = new SqlCommand(sqlStr, conn);
cmd.ExecuteNonQuery();
System.Console.WriteLine("Database created!!!");
}
catch (Exception)
{
System.Console.WriteLine("Could not establish Connection!");
}
finally
{
conn.Close();
System.Console.WriteLine("Connection closed!!!");
}
}
The code for creating Tables:
public void createProjectTables()
{
conn.ConnectionString = "Data Source=TURM21;Initial Catalog=XtmsDb;Integrated Security=SSPI;";
ArrayList createList = projectDBStrings.fillProjectSchema();
SqlTransaction tx;
SqlCommand cmd = new SqlCommand("", conn);
IEnumerator createListEnum = createList.GetEnumerator();
try
{
System.Console.WriteLine("Opening Connection...");
conn.Open();
System.Console.WriteLine("Connection opened!!!");
try
{
while (createListEnum.MoveNext())
{
sqlStr = (String)createListEnum.Current.ToString();
tx = conn.BeginTransaction();
cmd.CommandText = sqlStr;
cmd.Transaction = tx;
cmd.ExecuteNonQuery();
tx.Commit();
}
System.Console.WriteLine("Schema created!!!");
}
catch (SqlException deleteEx)
{
System.Console.WriteLine("SqlException Handle :{0}", deleteEx.ToString());
}
}
catch (SqlException connectionEx)
{
System.Console.WriteLine("SqlConnection Handle : {0}", connectionEx.ToString());
}
finally
{
conn.Close();
System.Console.WriteLine("Connection closed!!!");
}
}
Who can help me?
View 14 Replies
View Related
Aug 3, 2000
Hello all,
I need to restore my database and I keep getting a database in use error. Can someone tell me the easiest way to drop all connections to a database and open it exclusively?
Also, I'm not sure where this connection is coming from, there is another database on the same machine that has user connected, can these connections be the problem?
Thanks
Kevin Kraus
View 3 Replies
View Related
Oct 2, 2015
I have managed to successfully connect to another SQL Server instance using a linked server.
I can then do my select statement like this: select * from [servernameinstancename].[databasename].[databaseowner].[tablename]
I just wanted to know how I can drop the database on the other instance?I have tried doing: DROP DATABASE [servernameinstancename].[databasename].
View 3 Replies
View Related
May 28, 2008
Does anyone have a script that will iterate through a database and drop all objects in order of dependencies? I need a way recreate all objects in database through SQL script in a development environment without having to recreate the actual database. Therefore I need a way to clear out the current database objects first without running into a problem with dependencies. This needs to be dynamic so that if a object is added, it is automatically included in the drop scripts.
View 5 Replies
View Related
Jun 26, 2015
With some performance issues faced as I checked on Google came across Paul Randal's article on Logging & Recovery: URL...In this regard, and with some schema changes required, ended up with a decision to drop and re-create a database. What are the proper way to do the same and following queries:
A) What would be the recommended way to shift data from some tables of former database to that of the newer one (The latter ones created with the Script Table transaction)?
B) Would a simple Drop Database completely delete the former database completely and clean up the memory (database pages etc.) or I need to take some additional steps for clearing up the space?
C) Most of the data tables have been updated via loading the Bulk Insert commands time to time from CSV/flat files. Could that be somehow the cause of enlarging the the size of Database and Log?
View 16 Replies
View Related
Jan 9, 2008
Why in the hell doesn't SQL Server provide a facility for dropping anactive connection on an attached database in SQL Server Managementconsole? I can't detach an attached database because apparently thereis an active connection.I know you can use SSEUTIL but it seems like kluge for a poorlythought out function.Crazy
View 2 Replies
View Related
Jul 20, 2005
Hello,A while back I dropped a text column from a SQL Server 7 databaseroughly 3GB in size. I expected the size of the database to decreaseby around 1GB, but no change occurred. After searching usenet, Idiscovered that SQL Server 7 has no way of reclaiming that space, butthat there is some command that can be run in SQL Server 2000 thatwill reclaim it.I have since migrated this database to SQL Server 2000, and am nowtrying to figure out what that command is, but cannot locate anyusenet posts about it... also tried searching books online, but can'tfind anything that way either.Does anyone know what I should run?Thanks,Tom
View 6 Replies
View Related
Oct 15, 2015
I have a database consisting of two main tables and 12 sub tables.
This was leading to increase in database size. So we thought of storing the sub tables data in the main tables in form of xml in a column of varchar(2000) type.
So we created a new database that only had 2 tables and we stored the data of the sub tables in the new column of the main table.
Surprisingly we saw that the database size increased rather than decreasing .
View 9 Replies
View Related
Sep 13, 2007
Hi,I have transactional replication set up on on of our MS SQL 2000 (SP4)Std Edition database serverBecause of an unfortunate scenario, I had to restore one of thepublication databases. I scripted the replication module and droppedthe publication first. Then did a full restore.When I try to set up the replication thru the script, it created thepublication with the following error messageServer: Msg 2714, Level 16, State 5, Procedure SYNC_FCR ToGPRPTS_GL00100, Line 1There is already an object named 'SYNC_FCR To GPRPTS_GL00100' in thedatabase.It seems the previous replication has set up these system viewsSYNC_FCR To GPRPTS_GL00100. And I have tried dropping the replicationmodule again to see if it drops the views but it didn't.The replication fails with some wired error & complains about thisviews when I try to run the synch..I even tried running the sp_removedbreplication to drop thereplication module, but the views do not seem to disappear.My question is how do I remove these system views or how do I make thereplication work without using these views or create new views.. Whyis this creating those system views in the first place?I would appreciate if anyone can help me fix this issue. Please feelfree to let me know if any additional information or scripts needed.Thanks in advance..Regards,Aravin Rajendra.
View 2 Replies
View Related
Jan 17, 2002
Hi,
In my production box is running on SQL7.0 with Merge replication and i want add one more table and i want add one more column existing replication table. Any body guide me how to add .This is very urgent
Regards
Don
View 1 Replies
View Related
Oct 14, 2015
I have database on localhost and i want to show this data on my website. I want to create a database online and want to sync with Local Host. Can it be possible syncing data automatically after some interval?
View 6 Replies
View Related
Jul 20, 2005
We have a SQLSERVER database that is replicated to many users.We are currently in an expansion phase where we need to make changesto the server database. Each time we rollout a new release, we aredeleting the local replicating database and recreating.Is there any way to automatically transfer the changes from the serverto existing local database without deleting?
View 1 Replies
View Related
Jun 7, 2006
Is it possible to setup replication for a particular database from an SQL2005 database server to a SQL2000 database server.
I've searched a few forums and the MS knowledge base but can't find a specific answer.
Hopefully someone can point this novice in the right direction.
Mike
View 1 Replies
View Related
May 28, 2002
Is there a way we can prevent a object owner from dropping his tables. Example:
There is a user called 'tom' who is given create table permissions, 'tom' creates the table completes his dev and then the table is moved into production where 'tom' is still the owner. However, in production, 'tom' does not have the create table privs. Because 'tom' is the owner of the table, he is still able to drop the table in production. This is what I am trying to avoid. I would like to retain 'tom' as the owner and want to take away his create/drop privs.
View 1 Replies
View Related
Nov 17, 2000
Does anyone have any generic scripts that Drop all the statistics that SQL auto generates?? I have hundreds of '_WA_....'
indicies that are auto created by SS7 and I just want to get rid of ALL of them. Thanks!
View 3 Replies
View Related
Dec 7, 1999
Simple heres the syntax Alter Table XX Drop PRIMARY KEY.
This is not working whats up?
Thanks,
Phil
View 3 Replies
View Related
Apr 12, 2001
Whats the quickest way to drop a column from a table with 1 million rows.
This is for SQL Server 6.5
Thanks for all the responses,
Chan
View 1 Replies
View Related
May 22, 2001
I need to drop a database but cannot because there are 2 open connections that I cannot drop via EM. Is there a way to do this without starting and stopping??
View 2 Replies
View Related
Jul 20, 1998
Hi,
I`m new at SQL Server so excuse me if this question sounds dumb.
Does anybody know how to drop columns in a table. I know I can drop and re-build the table,
but I would prefer and easier way.
Thanks
-Z
View 1 Replies
View Related
Jul 6, 2001
I have run the following script to create a default on a table:
alter table TableXYY
add default 0 for ColumnX
Now, how do I delete this default (without re-creating the table)??
Thanks
View 1 Replies
View Related
Jul 23, 2001
Anyone know how to drop all users associated with a particular login not matter what database they're contained in?
ie login AdminUser / User AdminUser (in databases master, Dev1)
....
Thus, is there a way to drop the AdminUser login above and associated user
AdminUser in databases master, Dev1 in example above.
Thanks
View 1 Replies
View Related
Feb 22, 2004
Hi
I am using SQL server 7 database and ASP as front end. I run an application where a text file is loaded into database. After this is done procedures are run to create a set of tables that have snapshots of the data in the text file.. each time i load a new text file i want to create the snapshots.. i hve written a stored procedure to create tables and insert values into the tables.. however how do i delete the tables i created the previous time.. the number of snapshots and their names will depend on the size of the text file.. how do i refer to all the snapshots created and drop them all before creating new ones?
plese guide
regds
View 1 Replies
View Related
Jan 3, 2007
Looking for suggestions.
I have a database that is giving me a bad Index error. When I go to drop the necessary Index it is telling me that it either does not exist or cannot be dropped. However when I try to build that index, it tells me one already exists.
Is there any way to drop all of the indexes or at the very least see what the indexes are? This particular database is using 2005 Express.
Any help would be great!
Shawn
View 4 Replies
View Related