Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Thursday, March 29, 2012

Correct way of unistalling MSDE instance

Hi,
I am installing an MSDE instance using Setup ... call using a bat file.
I know the name of the instance (its a Given).
How do I uninstall automatically using a similar call?
I cannot afford to ask the user to uninstall it manually by using 'Add
remove programs'.
Also I would like to know if what I want to do is the correct way
or
Is there a standard way to uninstall (but not manually)?
In anycase I need to know how to uninstall an MSDE instance (Not MANUALLY) ?
Thanks
Subhojit
You can follow the following steps to uninstall manually.
Remove Files and Folders
Remove the MSDE 2000 instance data and program installation folders. You
can find the root folder information for the default instance data folder
in the SQLDataRoot registry key value under this registry key path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ Setup
For example, remove the MSDE 2000 data folder for a default instance:
\Program Files\Microsoft SQL Server\MSSQL\Data
For example, remove the MSDE 2000 data folder for a named instance:
\Program Files\Microsoft SQL Server\MSSQL$<INSTANCENAME>\Data
For example, remove the MSDE 2000 program folder for a default instance:
\Program Files\Microsoft SQL Server\MSSQL\Binn
For example, remove the MSDE 2000 program folder for a named instance:
\Program Files\Microsoft SQL Server\MSSQL$<INSTANCENAME>\Binn
back to the top
Clean Up the Registry
WARNING : If you use Registry Editor incorrectly, you may cause serious
problems that may require you to reinstall your operating system. Microsoft
cannot guarantee that you can solve problems that result from using
Registry Editor incorrectly. Use Registry Editor at your own risk.
The Msizap.exe tool removes only Windows Installer specific keys or data
for the ProductCode . It is best to manually remove the MSDE 2000 registry
keys. Use Registry Editor to remove the following MSDE 2000 registry keys:
For an MSDE 2000 default instance, remove the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
For an MSDE 2000 named instance, remove the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<INSTANCENAME>
If the following registry key points to the MSDE 2000 instance ProductCode
, remove the value InstanceComponentSet.x . For example,
InstanceComponentSet.1 has a value that matches the ProductCode of
Sqlrun01.msi:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Component
Set\InstanceComponentSet.1
Remove the SQLServer Service registry key.
For an MSDE 2000 default instance, remove the following:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\MSSQLServer
For an MSDE 2000 named instance, remove the following:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\MSSQL$<INSTANCENAME>
Remove the SQLServerAgent Service registry key:
For an MSDE 2000 default instance, remove the following:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLServerAgent
For an MSDE 2000 named instance, remove the following:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLAgent$<INSTANCENAME>
Girish Sundaram
Microsoft SQL Server Support Engineer
E-mail: girishs@.microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi Girish,
Thanks for replying.
**** "Just a request. Please read the posting before replying." ****
I really need to know how to uninstall MSDE instance "programatically" and
"not Manually".
Regards
"Girish Sundaram" wrote:

> You can follow the following steps to uninstall manually.
> Remove Files and Folders
> Remove the MSDE 2000 instance data and program installation folders. You
> can find the root folder information for the default instance data folder
> in the SQLDataRoot registry key value under this registry key path:
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ Setup
> For example, remove the MSDE 2000 data folder for a default instance:
> \Program Files\Microsoft SQL Server\MSSQL\Data
> For example, remove the MSDE 2000 data folder for a named instance:
> \Program Files\Microsoft SQL Server\MSSQL$<INSTANCENAME>\Data
> For example, remove the MSDE 2000 program folder for a default instance:
> \Program Files\Microsoft SQL Server\MSSQL\Binn
> For example, remove the MSDE 2000 program folder for a named instance:
> \Program Files\Microsoft SQL Server\MSSQL$<INSTANCENAME>\Binn
> back to the top
> Clean Up the Registry
> WARNING : If you use Registry Editor incorrectly, you may cause serious
> problems that may require you to reinstall your operating system. Microsoft
> cannot guarantee that you can solve problems that result from using
> Registry Editor incorrectly. Use Registry Editor at your own risk.
> The Msizap.exe tool removes only Windows Installer specific keys or data
> for the ProductCode . It is best to manually remove the MSDE 2000 registry
> keys. Use Registry Editor to remove the following MSDE 2000 registry keys:
> For an MSDE 2000 default instance, remove the following key:
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
> For an MSDE 2000 named instance, remove the following key:
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\<INSTANCENAME>
> If the following registry key points to the MSDE 2000 instance ProductCode
> , remove the value InstanceComponentSet.x . For example,
> InstanceComponentSet.1 has a value that matches the ProductCode of
> Sqlrun01.msi:
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Component
> Set\InstanceComponentSet.1
>
> Remove the SQLServer Service registry key.
> For an MSDE 2000 default instance, remove the following:
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\MSSQLServer
> For an MSDE 2000 named instance, remove the following:
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\MSSQL$<INSTANCENAME>
>
> Remove the SQLServerAgent Service registry key:
> For an MSDE 2000 default instance, remove the following:
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLServerAgent
> For an MSDE 2000 named instance, remove the following:
> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLAgent$<INSTANCENAME>
>
> Girish Sundaram
> Microsoft SQL Server Support Engineer
> E-mail: girishs@.microsoft.com
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
|||Possibly you can use a batch file to delete the folders from the drives.
You can use a script to delete the registry entries. The command to do so
is shown below.
The command that you can use to remove registry entries is
xp_deletevalue
Syntax:
xp_deletevalue hive, key, value
Example:
EXEC master..xp_regdeletevalue 'HKEY_LOCAL_MACHINE',
'Software\Clients', 'PaulWehland'
Hope this answers your query
Girish Sundaram
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi -
As you probably know, you can manually remove an MSDE instance using the
add/remove programs in the Control Panel. While that doesn't 'completely'
remove MSDE, you can do the same thing programmatically:
1. Read the MSDE GUID value from the Registry Key:
<MSDEGUID> = HKLM\SOFTWARE\Microsoft\Microsoft SQL
Server\<YourInstanceName>\Setup\ProductCode
2. Execute: msiexec.exe /x "<MSDEGUID>"
I've not found a way to _completely_ remove MSDE programmatically, but the
above may do what you need. Hope it helps.
- Jeff
"Subhojit Banerjee" <SubhojitBanerjee@.discussions.microsoft.com> wrote in
message news:A60CFD94-FC3F-4EA0-BDC1-3D490579BA7C@.microsoft.com...[vbcol=seagreen]
> Hi Girish,
> Thanks for replying.
> **** "Just a request. Please read the posting before replying." ****
> I really need to know how to uninstall MSDE instance "programatically" and
> "not Manually".
> Regards
>
> "Girish Sundaram" wrote:
folder[vbcol=seagreen]
Microsoft[vbcol=seagreen]
registry[vbcol=seagreen]
keys:[vbcol=seagreen]
Server\<INSTANCENAME>[vbcol=seagreen]
ProductCode[vbcol=seagreen]
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\MSSQL$<INSTANCENAME>[vbcol=seagreen]
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SQLAgent$<INSTANCENAME>[vbcol=seagreen]
rights.[vbcol=seagreen]

correct syntax for ALTER DATABASE MODIFY FILE

Hi All,
I get an error "Incorrect syntax near FILE" when I try to execute the
following
ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
What could be wrong with this and how can I fix it.
ThanksYou need to specify the desired database name. Try:
ALTER DATABASE CompanyDB
MODIFY FILE (NAME = 'MasterDB', NEWNAME = 'CompanyDB')
Hope this helps.
Dan Guzman
SQL Server MVP
"Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
news:%23XED$JXkFHA.4028@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I get an error "Incorrect syntax near FILE" when I try to execute the
> following
> ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
> What could be wrong with this and how can I fix it.
> Thanks
>|||Thanks Dan.
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:%231iIzlXkFHA.1204@.TK2MSFTNGP12.phx.gbl...
> You need to specify the desired database name. Try:
> ALTER DATABASE CompanyDB
> MODIFY FILE (NAME = 'MasterDB', NEWNAME = 'CompanyDB')
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
> news:%23XED$JXkFHA.4028@.TK2MSFTNGP10.phx.gbl...
>> Hi All,
>> I get an error "Incorrect syntax near FILE" when I try to execute the
>> following
>> ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
>> What could be wrong with this and how can I fix it.
>> Thanks
>

correct syntax for ALTER DATABASE MODIFY FILE

Hi All,
I get an error "Incorrect syntax near FILE" when I try to execute the
following
ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
What could be wrong with this and how can I fix it.
ThanksYou need to specify the desired database name. Try:
ALTER DATABASE CompanyDB
MODIFY FILE (NAME = 'MasterDB', NEWNAME = 'CompanyDB')
Hope this helps.
Dan Guzman
SQL Server MVP
"Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
news:%23XED$JXkFHA.4028@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I get an error "Incorrect syntax near FILE" when I try to execute the
> following
> ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
> What could be wrong with this and how can I fix it.
> Thanks
>|||Thanks Dan.
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:%231iIzlXkFHA.1204@.TK2MSFTNGP12.phx.gbl...
> You need to specify the desired database name. Try:
> ALTER DATABASE CompanyDB
> MODIFY FILE (NAME = 'MasterDB', NEWNAME = 'CompanyDB')
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
> news:%23XED$JXkFHA.4028@.TK2MSFTNGP10.phx.gbl...
>sql

correct syntax for ALTER DATABASE MODIFY FILE

Hi All,
I get an error "Incorrect syntax near FILE" when I try to execute the
following
ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
What could be wrong with this and how can I fix it.
Thanks
You need to specify the desired database name. Try:
ALTER DATABASE CompanyDB
MODIFY FILE (NAME = 'MasterDB', NEWNAME = 'CompanyDB')
Hope this helps.
Dan Guzman
SQL Server MVP
"Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
news:%23XED$JXkFHA.4028@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I get an error "Incorrect syntax near FILE" when I try to execute the
> following
> ALTER DATABASE MODIFY FILE (NAME = MasterDB, NEWNAME = CompanyDB)
> What could be wrong with this and how can I fix it.
> Thanks
>
|||Thanks Dan.
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:%231iIzlXkFHA.1204@.TK2MSFTNGP12.phx.gbl...
> You need to specify the desired database name. Try:
> ALTER DATABASE CompanyDB
> MODIFY FILE (NAME = 'MasterDB', NEWNAME = 'CompanyDB')
>
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Jason Fischer" <jason.fischer@.micropay.com.au> wrote in message
> news:%23XED$JXkFHA.4028@.TK2MSFTNGP10.phx.gbl...
>

Tuesday, March 27, 2012

Copying XML file into SQL

Hi, I have been having fun and games for well over a week now trying to get an xml file copied into an sql file, but still have no joy. I and using the bulk copy to do this and think I am close to solving it but just need a final push in the write direction.

In green below is the full source code, I think that the trouble is with the try statement part here:

Try

bulk.WriteToServer(xd)

This comes up with the error :

Unable to cast object of type 'System.Xml.XmlDocument' to type 'System.Data.IDataReader'

Basically how do I get the XML data into a reader (or IDataReader) format so that the writetoserver command can interpret it

I would be so greatful if someone could help resolve this it is becoming increasingly more frustrating

Protected Sub Button1_Click1(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Button1.ClickDim objXMLDim objXSL' destination tableDim connectionStringAs String = ConfigurationManager.ConnectionStrings("Database1ConnectionString").ConnectionStringDim myNewConnectionAs Data.SqlClient.SqlConnection =New Data.SqlClient.SqlConnection(connectionString) myNewConnection.Open()Dim productreaderAs XmlReaderDim bulkAs Data.SqlClient.SqlBulkCopy =New Data.SqlClient.SqlBulkCopy(myNewConnection) bulk.DestinationTableName ="Product"Dim productcountAs Integer = 0Dim settingsAs New System.Xml.XmlReaderSettings() settings.IgnoreWhitespace =True settings.IgnoreComments =True Dim xsAs String = (Server.MapPath("~/App_Data/XMLfile.xml")) Using readerAs XmlReader = XmlReader.Create(xs, settings)While (reader.Read())If (reader.NodeType = XmlNodeType.ElementAnd"product" = reader.LocalName)Then productcount += 1End If End While End Using Response.Write(String.Format("found {0} products!", productcount)) Using bulk bulk.DestinationTableName ="Product"Dim xdAs New System.Xml.XmlDocument() xd.Load("C:\Documents and Settings\Simon\My Documents\Visual Studio 2005\WebSites\WebSite1\App_Data\xmlfile.xml")Dim xrAs New System.Xml.XmlTextReader(Server.MapPath("~/App_Data/xmlfile.xml")) bulk.ColumnMappings.Add("TDProductId","TDProductId")' map First to first_name bulk.ColumnMappings.Add("name","name")' map Last to last_name bulk.ColumnMappings.Add("description","description")' map Date to first_sale bulk.ColumnMappings.Add("imageUrl","imageUrl")' map Amount to sale_amount bulk.ColumnMappings.Add("productUrl","productUrl")' map UserID from Session to user_id bulk.ColumnMappings.Add("price","price") bulk.ColumnMappings.Add("currency","currency") bulk.DestinationTableName ="Affilaite_Product_new"Try bulk.WriteToServer(xd)Catch exAs Exception Response.Write(ex.Message)Finally myNewConnection.Close() bulk.Close() xd =Nothing End Try End UsingEnd Sub

That's because bulk.WriteToServer method will not accept an XmlDocument as parameter. Why not use a DataSet in this case? So you can use such code:

Dim xs As String = (Server.MapPath("~/App_Data/XMLfile.xml"))
Dim ds As New DataSet
ds.ReadXml(xs, XmlReadMode.Auto)
--...add your code
bulk.ColumnMappings.Add("TDProductId", "TDProductId")
--...
bulk.WriteToServer(ds.Tables(0))

BTW, if you're using SQL2005, you can load XML files (actually all BLOB data, including images) into SQL database by using simply OPENROWSET with SINGLE_BLOB option. You can take a look at:

http://msdn.microsoft.com/library/en-us/dnsql90/html/sql2k5xml.asp?frame=true

|||

This works a treat, many thanks for thank.

I've notice it doesn't like inserting into nulls or primary keys, but I shall look into that now.

Cheers again great advice

Thursday, March 22, 2012

Copying SQL, mdf file / Please help

I have a SQL db on my server in internet
the server and my DB is online
I want to copy mdf file to my computer via FTP but I get an error
that file is in use and I can`t copy it

I wanted to know is there any way that i copy information in that MDF fle
to another DB on my computer

Its very important please help me

thanks allI don`t have permission to remote access or change any thing in Enterprise Manager
:(|||I'd do a SQL Server Backup (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ba-bz_35ww.asp), and then FTP the resulting backup (aka DUMP) file. You can use that to rebuild a copy of the database on another machine.

-PatP|||You can do sp_detach+ftp_sp_attach to do the same, except a lot faster.|||You can do sp_detach+ftp_sp_attach to do the same, except a lot faster.

Hi buddy
thanks but can you tell me how can i use that code
and where I can use it

thanks alot|||I just have permission to use FTP nowsql

Tuesday, March 20, 2012

Copying of database

I tried to write a batch script which copies a database by making full
backup, then copying the backup file to another location and restoring it.
The backup schedule of the my database is this:
full backup on sunday at 23 h stored in file1
differential backup every day except sunday at 23h stored in file2
Now i'm not sure what will happen with my differential scheduled backups
when i delete the temporary backup file that is made only for copying during
the w. It's stored in another file (let's call it file3). I see that SQL
Server remembers every full backup, is there a way to tell it not to write
to backup history tables?
I'm thinking of another ways of copying database. One is to detach the
database or to stop the server but i think it's not good. Another way is DTS
package. Can you tell me if it can do the trick? Is there another way?
Thank you in advance
Georgi PeshterskiWays of copying a database:
1. Certainly backup and restore is an option, but not the first I would take
.
2. Detach, copy and attach also works, but it is kludgy.
3. Snapshot replication works well if you desire a snapshot to copy at any
one time (ie, the update is the entire database and instant update of data i
s
not important).
4. Transaction replication works well if you need real time updates
5. DTS works, as well, but can end up with unnecessary locking on the
original database while you are migrating. You have some control over this,
of course, but it gets more advanced.
I would aim for replication or DTS long before using a backup/restore or
detach/copy/attach scenario.
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"George Peshterski" wrote:

> I tried to write a batch script which copies a database by making full
> backup, then copying the backup file to another location and restoring it.
> The backup schedule of the my database is this:
> full backup on sunday at 23 h stored in file1
> differential backup every day except sunday at 23h stored in file2
> Now i'm not sure what will happen with my differential scheduled backup
s
> when i delete the temporary backup file that is made only for copying duri
ng
> the w. It's stored in another file (let's call it file3). I see that SQ
L
> Server remembers every full backup, is there a way to tell it not to write
> to backup history tables?
> I'm thinking of another ways of copying database. One is to detach the
> database or to stop the server but i think it's not good. Another way is D
TS
> package. Can you tell me if it can do the trick? Is there another way?
> Thank you in advance
> Georgi Peshterski
>
>|||Thank you, i'm working to do it with DTS
"Cowboy (Gregory A. Beamer) - MVP" <NoSpamMgbworld@.comcast.netNoSpamM> wrote
in message news:F34C25E5-AD13-4255-B1E0-38CBD3481C5F@.microsoft.com...
> Ways of copying a database:
> 1. Certainly backup and restore is an option, but not the first I would
take.
> 2. Detach, copy and attach also works, but it is kludgy.
> 3. Snapshot replication works well if you desire a snapshot to copy at any
> one time (ie, the update is the entire database and instant update of data
is
> not important).
> 4. Transaction replication works well if you need real time updates
> 5. DTS works, as well, but can end up with unnecessary locking on the
> original database while you are migrating. You have some control over
this,
> of course, but it gets more advanced.
> I would aim for replication or DTS long before using a backup/restore or
> detach/copy/attach scenario.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> ***************************
> Think Outside the Box!
> ***************************
> "George Peshterski" wrote:
>
full
it.
backups
during
SQL
write
the
DTS

copying my database to another offsite computer

My need: I want to copy my databse (the file itself) in a mem card so that I can use it in another comuter offsite.
How do I do that. it s like a back up I think, except that I ll need to import the DB in another computer at home.
When I try using Backup the DB of Entreprise Manager, I get violation error, can t copy the file being used or something like that. Am I doing it the right way or is there another better way to do this.

Thanks

One way you can do this:

First you detach your database from EM , and find where your database's data file is, by default installation, the database file is in this folder: C:\Program Files\Microsoft SQL Server\MSSQL\Data.(attach the database after you copy it)

Then, copy the .mdf file of your database to your memory card.

From another computer, you can simply attach it through EM. Good to go.

|||thank u

Sunday, March 11, 2012

copying Databases

I backed a MSSQL2000 database into a BAK file. Now when I create a
MSSQL2005 system and I goto RESTORE - after creating a database with the
same name- I get
"ERROR the backup set holds a database other than the existing "Toxinet'
database. RESTORE DATABASE is terminating abnormally"
Any ideas? This process has always worked in MSSQL97 & 2000
Thanks,
Raul Rego
NJPIES
rrego@.njpies.org
Hi Raul
From your limited information, it sounds like the name in the backup is not
what you think it is.
You don't have to create a database before doing a restore. Why don't you
just try restoring and letting the restore process create the database.
Perhaps there is a spelling issue or you have a case sensitive collation.
BTW, there was no MSSQL97. The version before SQL Server 2000 was SQL Server
7.
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Raul" <rrego@.njpies.org> wrote in message
news:BCE20BE9-3480-43A4-9B44-C6A0F628B38A@.microsoft.com...
>I backed a MSSQL2000 database into a BAK file. Now when I create a
>MSSQL2005 system and I goto RESTORE - after creating a database with the
>same name- I get
> "ERROR the backup set holds a database other than the existing "Toxinet'
> database. RESTORE DATABASE is terminating abnormally"
> Any ideas? This process has always worked in MSSQL97 & 2000
> Thanks,
> Raul Rego
> NJPIES
> rrego@.njpies.org
>
|||Use the "with replace" clause.
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
"Raul" <rrego@.njpies.org> wrote in message
news:BCE20BE9-3480-43A4-9B44-C6A0F628B38A@.microsoft.com...
>I backed a MSSQL2000 database into a BAK file. Now when I create a
>MSSQL2005 system and I goto RESTORE - after creating a database with the
>same name- I get
> "ERROR the backup set holds a database other than the existing "Toxinet'
> database. RESTORE DATABASE is terminating abnormally"
> Any ideas? This process has always worked in MSSQL97 & 2000
> Thanks,
> Raul Rego
> NJPIES
> rrego@.njpies.org
>

copying Databases

I backed a MSSQL2000 database into a BAK file. Now when I create a
MSSQL2005 system and I goto RESTORE - after creating a database with the
same name- I get
"ERROR the backup set holds a database other than the existing "Toxinet'
database. RESTORE DATABASE is terminating abnormally"
Any ideas? This process has always worked in MSSQL97 & 2000
Thanks,
Raul Rego
NJPIES
rrego@.njpies.orgHi Raul
From your limited information, it sounds like the name in the backup is not
what you think it is.
You don't have to create a database before doing a restore. Why don't you
just try restoring and letting the restore process create the database.
Perhaps there is a spelling issue or you have a case sensitive collation.
BTW, there was no MSSQL97. The version before SQL Server 2000 was SQL Server
7.
--
HTH
Kalen Delaney, SQL Server MVP
www.InsideSQLServer.com
http://blog.kalendelaney.com
"Raul" <rrego@.njpies.org> wrote in message
news:BCE20BE9-3480-43A4-9B44-C6A0F628B38A@.microsoft.com...
>I backed a MSSQL2000 database into a BAK file. Now when I create a
>MSSQL2005 system and I goto RESTORE - after creating a database with the
>same name- I get
> "ERROR the backup set holds a database other than the existing "Toxinet'
> database. RESTORE DATABASE is terminating abnormally"
> Any ideas? This process has always worked in MSSQL97 & 2000
> Thanks,
> Raul Rego
> NJPIES
> rrego@.njpies.org
>|||Use the "with replace" clause.
--
Jason Massie
www: http://statisticsio.com
rss: http://feeds.feedburner.com/statisticsio
"Raul" <rrego@.njpies.org> wrote in message
news:BCE20BE9-3480-43A4-9B44-C6A0F628B38A@.microsoft.com...
>I backed a MSSQL2000 database into a BAK file. Now when I create a
>MSSQL2005 system and I goto RESTORE - after creating a database with the
>same name- I get
> "ERROR the backup set holds a database other than the existing "Toxinet'
> database. RESTORE DATABASE is terminating abnormally"
> Any ideas? This process has always worked in MSSQL97 & 2000
> Thanks,
> Raul Rego
> NJPIES
> rrego@.njpies.org
>

Copying database file to another drive fails

I have an active/passive cluster involving 2 machines. I have 3 instances
running on the production server. One of the drives allocated to instance 2
was running out of space so I decided to move one of the larger databases to
another drive that can handle its size. The drive that I was going to move
the data file to is part of the same instance group in the cluster. After
detaching the database I attempted to move the data file to this drive but at
the end of the copy I receive a message that there was an error copying file
because of insufficient resources exist to complete the requested server. I
double checked the drive and there is plenty of space for this file and like
I said the drive is already part of the cluster group.
Anyone have any other suggestions on what the problem might be? Thanks
You could be out of physical memory or file handles. I have seen some
monitoring programs that "leaked" handles badly. Sometimes stopping and
restarting the SNMP service fixed it, but sometimes I had to wait and reboot
the host node during a scheduled maintenance window.
You could also have a problem due to Anti-virus programs. AV and clusters
have never gotten along well.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"ronc" <ronc@.discussions.microsoft.com> wrote in message
news:E699545D-9DD4-47EB-A6F1-F7A29EFD7C39@.microsoft.com...
>I have an active/passive cluster involving 2 machines. I have 3 instances
> running on the production server. One of the drives allocated to instance
> 2
> was running out of space so I decided to move one of the larger databases
> to
> another drive that can handle its size. The drive that I was going to
> move
> the data file to is part of the same instance group in the cluster. After
> detaching the database I attempted to move the data file to this drive but
> at
> the end of the copy I receive a message that there was an error copying
> file
> because of insufficient resources exist to complete the requested server.
> I
> double checked the drive and there is plenty of space for this file and
> like
> I said the drive is already part of the cluster group.
> Anyone have any other suggestions on what the problem might be? Thanks
|||One other thing that I forgot to mention was that I was able to successfully
move a 20 GB backup file to the drive I was trying to copy to and it copied
successfully. Memory does not seem to be the problem. I still think it
has something to do specifically with the .dat file being moved but what that
is I'm not sure. I know that I can always do a backup and restore and
speicify the drive but I know that I should be able to do it this way by
coping and then reattching. Thanks again.
"Geoff N. Hiten" wrote:

> You could be out of physical memory or file handles. I have seen some
> monitoring programs that "leaked" handles badly. Sometimes stopping and
> restarting the SNMP service fixed it, but sometimes I had to wait and reboot
> the host node during a scheduled maintenance window.
> You could also have a problem due to Anti-virus programs. AV and clusters
> have never gotten along well.
> --
> Geoff N. Hiten
> Senior Database Administrator
> Microsoft SQL Server MVP
>
> "ronc" <ronc@.discussions.microsoft.com> wrote in message
> news:E699545D-9DD4-47EB-A6F1-F7A29EFD7C39@.microsoft.com...
>
>
|||Do you use any anti virus software or things like that ?
"ronc" wrote:
[vbcol=seagreen]
> One other thing that I forgot to mention was that I was able to successfully
> move a 20 GB backup file to the drive I was trying to copy to and it copied
> successfully. Memory does not seem to be the problem. I still think it
> has something to do specifically with the .dat file being moved but what that
> is I'm not sure. I know that I can always do a backup and restore and
> speicify the drive but I know that I should be able to do it this way by
> coping and then reattching. Thanks again.
>
> "Geoff N. Hiten" wrote:

Thursday, March 8, 2012

copying database backup file

This is a pretty basic question, but I've generated a backup file for one of my SQL 2000 databases, and I need to copy the backup file to another computer so I can burn it on CD. Whenever I try to copy the file, I get an error message saying that the file is in use by another process and can't be copied. I have tried detaching the database, shutting down Enterprise Manager, stopping the MSSQL service, but all to no avail. There must be a way to do this, but I can't get it to work. Does anyone have any ideas?This shouldn't happen for the backup file, unless you are accessing the backup somehow. What is the filename you backuped up to? have you tried stopping SQL Server, then copying? Since I don't want to assume anything, I'll add this: make sure you are copying the backup file, not the mdb or ldf file.|||If you used Enterprise Manager, you may want to make sure you remove the backupfile from the SQLserver Backup options in All Tasks. But it is intriguing that the file is still in use.|||I tried all of the suggestions posted, but the only thing that ended up working was to rename the backup. The original backup had the same name as the database, but once I made another backup with a different name, I was able to copy the file. Thanks again for the help!

Copying Data to a File

Hi Guys,
I am trying to fix the following problem:
I need to create a .txt for input into a unix based system (sybase).
This has been done using BCP, and not DTS. Once BCP'ing data into the
.txt file, there are <CR><LF> data at the end of every row. Once the
data is imported into the unix system, these are showing up in the
database.
I've tried BCP with the:
-r \n
-r \r
-r \n \r
With no success (the characters still appear in sybase).
Is there any way to do this with BCP, and not have the characters
appear?
thanks,
Justinjustin.drennan@.gmail.com wrote:
> Hi Guys,
> I am trying to fix the following problem:
> I need to create a .txt for input into a unix based system (sybase).
> This has been done using BCP, and not DTS. Once BCP'ing data into the
> .txt file, there are <CR><LF> data at the end of every row. Once the
> data is imported into the unix system, these are showing up in the
> database.
> I've tried BCP with the:
> -r \n
> -r \r
> -r \n \r
> With no success (the characters still appear in sybase).
> Is there any way to do this with BCP, and not have the characters
> appear?
You might want to try the tr command in *nix:
in_file | tr -d \r > out_file
Delete the carriage return character from the in_file and output to the
out_file.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

copying data from Microsoft Access to SQL Server

Hello

I am developing a web application that will allow users to upload a .mdb file and from that file I need to populate an SQL database. I know the table name of the .mdb file, but I am unclear how to structure my data access layer correctly. How do I pull data from the .mdb file and once I have it how do i populate the SQL database?

Any advice would be greatly appreciated.


thanks!

There is one problem with moving Access data on the fly Access let people to just point and click what they wish, if that is your situation you need DTS because in SQL Server your data must be clean and relational. So if you have clean table definitions and clean inserts you could just use OpenRowset or OpenQuery. If not then DTS is your friend. So check your setup and post specifics so I can give you the resources as needed. Hope this helps.

Wednesday, March 7, 2012

Copying BAK file

When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
this:
copy DBF_db_20040602.BAK .
it copies the entire file to the current directory where the cmd-file is
started.
So far so good...
But, when I change the cmd-file to do this:
copy DBF_db_20040602.BAK DBF_newfile.BAK
is only creates a file of only 6k in size. The original file is about 2 Gb
in size.
Anyone knows why this happens?
..Nico
hi
Have u tried using xcopy?
J
"Nico" <duiken@.nospam.nl> wrote in message
news:40bdeb35$0$136$18b6e80@.news.wanadoo.nl...
> When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
> this:
> copy DBF_db_20040602.BAK .
> it copies the entire file to the current directory where the cmd-file is
> started.
> So far so good...
> But, when I change the cmd-file to do this:
> copy DBF_db_20040602.BAK DBF_newfile.BAK
> is only creates a file of only 6k in size. The original file is about 2 Gb
> in size.
> Anyone knows why this happens?
> .Nico
>
|||Nico,
Sounds strange. I suggest you post this to a windows forum, as likelyhood to find Windows experts should be
higher there... :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nico" <duiken@.nospam.nl> wrote in message news:40bdeb35$0$136$18b6e80@.news.wanadoo.nl...
> When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
> this:
> copy DBF_db_20040602.BAK .
> it copies the entire file to the current directory where the cmd-file is
> started.
> So far so good...
> But, when I change the cmd-file to do this:
> copy DBF_db_20040602.BAK DBF_newfile.BAK
> is only creates a file of only 6k in size. The original file is about 2 Gb
> in size.
> Anyone knows why this happens?
> .Nico
>

Copying BAK file

When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
this:
copy DBF_db_20040602.BAK .
it copies the entire file to the current directory where the cmd-file is
started.
So far so good...
But, when I change the cmd-file to do this:
copy DBF_db_20040602.BAK DBF_newfile.BAK
is only creates a file of only 6k in size. The original file is about 2 Gb
in size.
Anyone knows why this happens?
.Nicohi
Have u tried using xcopy?
J
"Nico" <duiken@.nospam.nl> wrote in message
news:40bdeb35$0$136$18b6e80@.news.wanadoo.nl...
> When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
> this:
> copy DBF_db_20040602.BAK .
> it copies the entire file to the current directory where the cmd-file is
> started.
> So far so good...
> But, when I change the cmd-file to do this:
> copy DBF_db_20040602.BAK DBF_newfile.BAK
> is only creates a file of only 6k in size. The original file is about 2 Gb
> in size.
> Anyone knows why this happens?
> .Nico
>|||Nico,
Sounds strange. I suggest you post this to a windows forum, as likelyhood to
find Windows experts should be
higher there... :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nico" <duiken@.nospam.nl> wrote in message news:40bdeb35$0$136$18b6e80@.news.wanadoo.nl...[vb
col=seagreen]
> When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
> this:
> copy DBF_db_20040602.BAK .
> it copies the entire file to the current directory where the cmd-file is
> started.
> So far so good...
> But, when I change the cmd-file to do this:
> copy DBF_db_20040602.BAK DBF_newfile.BAK
> is only creates a file of only 6k in size. The original file is about 2 Gb
> in size.
> Anyone knows why this happens?
> .Nico
>[/vbcol]

Copying BAK file

When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
this:
copy DBF_db_20040602.BAK .
it copies the entire file to the current directory where the cmd-file is
started.
So far so good...
But, when I change the cmd-file to do this:
copy DBF_db_20040602.BAK DBF_newfile.BAK
is only creates a file of only 6k in size. The original file is about 2 Gb
in size.
Anyone knows why this happens?
.Nicohi
Have u tried using xcopy?
J
"Nico" <duiken@.nospam.nl> wrote in message
news:40bdeb35$0$136$18b6e80@.news.wanadoo.nl...
> When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
> this:
> copy DBF_db_20040602.BAK .
> it copies the entire file to the current directory where the cmd-file is
> started.
> So far so good...
> But, when I change the cmd-file to do this:
> copy DBF_db_20040602.BAK DBF_newfile.BAK
> is only creates a file of only 6k in size. The original file is about 2 Gb
> in size.
> Anyone knows why this happens?
> .Nico
>|||Nico,
Sounds strange. I suggest you post this to a windows forum, as likelyhood to find Windows experts should be
higher there... :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Nico" <duiken@.nospam.nl> wrote in message news:40bdeb35$0$136$18b6e80@.news.wanadoo.nl...
> When I copy a BACKUP using a .cmd file from a command-box in Win2K, like
> this:
> copy DBF_db_20040602.BAK .
> it copies the entire file to the current directory where the cmd-file is
> started.
> So far so good...
> But, when I change the cmd-file to do this:
> copy DBF_db_20040602.BAK DBF_newfile.BAK
> is only creates a file of only 6k in size. The original file is about 2 Gb
> in size.
> Anyone knows why this happens?
> .Nico
>

Saturday, February 25, 2012

Copying .MDF & .LDF files for new server

Hello - I am trying to copy a database file from our existing server into an FTP site so I can download and then upload to a new server. When using the file explorer and copy command I recieve an error that the states

" Cannot copy ***data file: It is being used by another person or program, close any programs that might be using the file and try again"

I have stopped MS SQL, stopped IIS etc - ANY SUGGESTIONS?

VinceDetach the database before trying to copy it.|||

Quote:

Originally Posted by seniorinsight

Hello - I am trying to copy a database file from our existing server into an FTP site so I can download and then upload to a new server. When using the file explorer and copy command I recieve an error that the states

" Cannot copy ***data file: It is being used by another person or program, close any programs that might be using the file and try again"

I have stopped MS SQL, stopped IIS etc - ANY SUGGESTIONS?

Vince


Use the Backup tool from Enterprise manager. Copy and load the backup on your new server. This is the proper way to transfer databases.

CopyFile in DTS ActiveX Script Task

I am trying to copy a file and giving it a name with a date behind it. Belo
w
is my code I'm using in my DTS ActiveX Script Task. I'm getting a "File Not
Found" message on Line 25 (I marked it below). Can someone see the problem
with my code'
Dim NYear
Dim NMonth
Dim NDate
NYear = Year(Date)
NMonth = Month(Date)
NDate = CStr(NYear) + CStr(NMonth)
Dim oFSO
Dim sSourceFile
Dim sDestinationFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
sSourceFile =
" \\wstlfp02\ebs$\SQLDataAccess\WPE\PandGI
nvoicesToMCFA\PGInvoiceDetailYYYYMM
"
sDestinationFile =
" \\wstlfp02\ebs$\SQLDataAccess\WPE\PandGI
nvoicesToMCFA\PGInvoiceDetail" +
"_RunDate_" + NDate
oFSO.CopyFile sSourceFile, sDestinationFile '***(This is Line 25)***
' Clean Up
Set oFSO = Nothing
Main = DTSTaskExecResult_SuccessHi
I assume you have tried outputting the file names in a MsgBox and validated
that they are correct? http://www.sqldts.com/default.aspx?292 has an example
of using the filesystem object to copy a file, and
http://www.sqldts.com/default.aspx?200 has an example of using the date as
part of a filename.
Make sure that the account that you are running this has permissions to the
share, it may be worth getting it working with a local drive first.
John
"atchleykl" wrote:

> I am trying to copy a file and giving it a name with a date behind it. Be
low
> is my code I'm using in my DTS ActiveX Script Task. I'm getting a "File N
ot
> Found" message on Line 25 (I marked it below). Can someone see the proble
m
> with my code'
> Dim NYear
> Dim NMonth
> Dim NDate
> NYear = Year(Date)
> NMonth = Month(Date)
> NDate = CStr(NYear) + CStr(NMonth)
> Dim oFSO
> Dim sSourceFile
> Dim sDestinationFile
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> sSourceFile =
> " \\wstlfp02\ebs$\SQLDataAccess\WPE\PandGI
nvoicesToMCFA\PGInvoiceDetailYYYY
MM"
> sDestinationFile =
> " \\wstlfp02\ebs$\SQLDataAccess\WPE\PandGI
nvoicesToMCFA\PGInvoiceDetail" +
> "_RunDate_" + NDate
> oFSO.CopyFile sSourceFile, sDestinationFile '***(This is Line 25)***
> ' Clean Up
> Set oFSO = Nothing
> Main = DTSTaskExecResult_Success
>

Friday, February 24, 2012

Copy XML File to SQL Server Table.

A need, to take a XML File and copy the contents into SQL Server 2000 Table,
from a Store Procedure.
Necesito, tomar un archivo XML y copiar el contenido de este a una Tabla de
SQL SERVER 2000, desde un Procedimiento Almacenado.Javier,
Take a look at OPENXML in the BOL. I have provided you with a code sample
below. Just remember to use sp_xml_preparedocument and sp_xml_removedocument
correctly or you will encounter a memory leak.
Good Luck.
--
DECLARE @.idoc INT
EXEC sp_xml_preparedocument @.idoc OUTPUT, '<Person ID="5"
FirstName="John" LastName="Doe">
<Sales QtyPurchased="2"/>
<Sales QtyPurchased="3"/>
</Person>'
select * from openxml(@.idoc, '*')
EXEC sp_xml_removedocument @.idoc|||Thank you, very much Brian, but it not is the I like me. I need that in place
of I write '<Person ID="5"
> FirstName="John" LastName="Doe">
> <Sales QtyPurchased="2"/>
> <Sales QtyPurchased="3"/>
> </Person>', I will can writing the File.xml name.
Muchas Gracias Brian, pero no es lo que buscaba. Yo necesito que en lugar de
escribir <Person ID="5"
FirstName="John" LastName="Doe">
<Sales QtyPurchased="2"/>
<Sales QtyPurchased="3"/>
</Person>, yo pudiera escribir el nombre del archivo.xml.
Javier.|||Sorry Javier, but you will have to open the file with an application and then
pass it to your stored procedure. If it must be contained within SQL Server
you could create a DTS to parse the xml file and then import it into your
table.
I hope that this helps!