Showing posts with label users. Show all posts
Showing posts with label users. Show all posts

Saturday, February 25, 2012

Avoiding Setting xp_cmdshell in SQL 2005

Would anyone know, how to work around a potential problem of not using xp_cmdshell.

For our users, We are using xp_cmdshell to look up the xml files in a particular folder and process them into Database. xp_cmdshell is used to read the contents of the file and build up the string for the stored procedure parameter input.

In SQL 2000, xp_cmdshell was set by default. in SQL 2005 not set by default and some of my users doesn't want to set it suggesting security concerns.

Thanks.

You could use OPENROWSET with BULK option for upload xml file as sigle blob into one database field. For example:

Code Snippet

INSERT INTO myTable(Document)
SELECT * FROM OPENROWSET(BULK N'C:\data.xml', SINGLE_BLOB) AS Document

Then you could use xml data type functions for split data. See xml.value, xml.nodes in BOL

Monday, February 13, 2012

Availability while applying a snapshot

In merge replication, if I select to re-initialize the subscriber. Is the database available to the end users while the snapshot is being applied?
The publisher requires a table lock to create the snapshot, while on the
subscriber it depends on the sync type. By default you'll drop the table on
the subscriber and recreate it, which would preclude user availability.
Regards,
Paul Ibison
"ReplGuy" <anonymous@.discussions.microsoft.com> wrote in message
news:E90EEDC1-D397-41D9-B413-D2B1FD10B6E0@.microsoft.com...
> In merge replication, if I select to re-initialize the subscriber. Is the
database available to the end users while the snapshot is being applied?
|||Thanks Paul,
So if I want the users to keep on working, then I should ellect not to re-initialize the database? Is this correct?
|||It depends why you are reinitializing. If it is because the schema has
modified substantially, then it is mandatory and your subscriber users will
not be able to access the table. If there is an addition of a column, then
sp_repladdcolumn is needed rather than reinitialization. As for the
reinitialization, it is usually treated as an out-of-hours procedure because
of this restriction.
HTH,
Paul Ibison
|||well it is available but merge replication by default deletes the data in the existing table and then refreshes it. So for a moment or two (depending on how long it takes to bcp the data in) the table is empty.
While the truncation and refreshing is going on there is some locking.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html