Showing posts with label back. Show all posts
Showing posts with label back. Show all posts

Tuesday, March 27, 2012

clear Cached reports in Visual studio

I am frequently going back and forth between the making changes to my reports and previewing those changes, all from within visual studio without publishing the reports each time.

The problem is that frequently changes that I make are not reflected in the preview window unless I either close out of visual studio completely or I wait some length of time, (I'm not sure how long exactly, but 1/2 an hour seems to always do the trick.)

Is there a way to clear any cache and force visual studio to completely reprocess a report?

At least when it is formatting changes I can identify whether the change has stuck, but when I'm fixing bugs in the code, I can't tell if I didn't fix it or if the change just hasn't taken effect.

the simplest method is to rebuild the report, after that hit the refresh button.sqlsql

Sunday, March 25, 2012

Clean out (Reinitialize) SQL Server Database?

It there an easy way to 'clean out' a SQL Server database? I need to get a
database of an unknown state back to a known state of 'empty'. Is there an
easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES,
TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?)
(I don't want to rely on Dropping the Database and recreating it entirely as
a new database, since this requires a priviledge escalation as compared to
the priviledges required for working on structures inside of the database.)
Thanks for your help!
- Joseph Geretz -
You could easily write a proc with a little cursor to do this using
2005:
select name, type
from sys.objects
2000
select name, xtype
from sysobjects
Then just use the type of proc to determine what drop statement to use. I
think this will do it, even considering constraints (sometimes you have to
drop the constraint before the columns,) I think if you limit this to:
sys.objects.type in ('P', 'FN', 'U', 'IF', 'TF', 'V') --pretty much the same
in 2000
--procedure, scalar function, user table, inline function, table value
function
You can do it. You would just have to run the cursor multiple times to
eliminate dependencies, or you could add foreign keys if you want to using
the information_schema,table_constraints for that.
I might also suggest you could just write a sql agent job that could be
executed to clean out the database pretty easily by killing any users,
dropping the database and recreating it, if you really want to just start
over.
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Joseph Geretz" <jgeretz@.nospam.com> wrote in message
news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
> It there an easy way to 'clean out' a SQL Server database? I need to get a
> database of an unknown state back to a known state of 'empty'. Is there an
> easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS,
> INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?)
> (I don't want to rely on Dropping the Database and recreating it entirely
> as a new database, since this requires a priviledge escalation as compared
> to the priviledges required for working on structures inside of the
> database.)
> Thanks for your help!
> - Joseph Geretz -
>
|||Here's a link to a script to drop all user objects using the basic technique
Louis suggested. You can tweak for SQL 2005, although the need to do this
might be mitigated if you can do DROP/CREATE DATABASE instead.
http://tinyurl.com/9t9m6
Hope this helps.
Dan Guzman
SQL Server MVP
"Joseph Geretz" <jgeretz@.nospam.com> wrote in message
news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
> It there an easy way to 'clean out' a SQL Server database? I need to get a
> database of an unknown state back to a known state of 'empty'. Is there an
> easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS,
> INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?)
> (I don't want to rely on Dropping the Database and recreating it entirely
> as a new database, since this requires a priviledge escalation as compared
> to the priviledges required for working on structures inside of the
> database.)
> Thanks for your help!
> - Joseph Geretz -
>
|||Joseph
you can back up an empty database, then restore the backup against the
database you wish to clean up
HIH
|||Thanks Dan!
Your script works perfectly for us.
- Joe Geretz -
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:uhxmpBrHGHA.1088@.tk2msftngp13.phx.gbl...
> Here's a link to a script to drop all user objects using the basic
> technique Louis suggested. You can tweak for SQL 2005, although the need
> to do this might be mitigated if you can do DROP/CREATE DATABASE instead.
> http://tinyurl.com/9t9m6
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Joseph Geretz" <jgeretz@.nospam.com> wrote in message
> news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
>
|||Nice
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:uhxmpBrHGHA.1088@.tk2msftngp13.phx.gbl...
> Here's a link to a script to drop all user objects using the basic
> technique Louis suggested. You can tweak for SQL 2005, although the need
> to do this might be mitigated if you can do DROP/CREATE DATABASE instead.
> http://tinyurl.com/9t9m6
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Joseph Geretz" <jgeretz@.nospam.com> wrote in message
> news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
>
sqlsql

Clean out (Reinitialize) SQL Server Database?

It there an easy way to 'clean out' a SQL Server database? I need to get a
database of an unknown state back to a known state of 'empty'. Is there an
easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS, INDEXES,
TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?)
(I don't want to rely on Dropping the Database and recreating it entirely as
a new database, since this requires a priviledge escalation as compared to
the priviledges required for working on structures inside of the database.)
Thanks for your help!
- Joseph Geretz -What are you actually trying to accomplish here? If you drop all of the
database objects, what are you trying to preserve for future use?
========================================
==========
People who want to share their religious views with you almost never
want you to share yours with them. -Dave Barry, author and columnist
(1947- )
*** Sent via Developersdex http://www.examnotes.net ***|||You could easily write a proc with a little cursor to do this using
2005:
select name, type
from sys.objects
2000
select name, xtype
from sysobjects
Then just use the type of proc to determine what drop statement to use. I
think this will do it, even considering constraints (sometimes you have to
drop the constraint before the columns,) I think if you limit this to:
sys.objects.type in ('P', 'FN', 'U', 'IF', 'TF', 'V') --pretty much the same
in 2000
--procedure, scalar function, user table, inline function, table value
function
You can do it. You would just have to run the cursor multiple times to
eliminate dependencies, or you could add foreign keys if you want to using
the information_schema,table_constraints for that.
I might also suggest you could just write a sql agent job that could be
executed to clean out the database pretty easily by killing any users,
dropping the database and recreating it, if you really want to just start
over.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Joseph Geretz" <jgeretz@.nospam.com> wrote in message
news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
> It there an easy way to 'clean out' a SQL Server database? I need to get a
> database of an unknown state back to a known state of 'empty'. Is there an
> easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS,
> INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?)
> (I don't want to rely on Dropping the Database and recreating it entirely
> as a new database, since this requires a priviledge escalation as compared
> to the priviledges required for working on structures inside of the
> database.)
> Thanks for your help!
> - Joseph Geretz -
>|||Here's a link to a script to drop all user objects using the basic technique
Louis suggested. You can tweak for SQL 2005, although the need to do this
might be mitigated if you can do DROP/CREATE DATABASE instead.
http://tinyurl.com/9t9m6
Hope this helps.
Dan Guzman
SQL Server MVP
"Joseph Geretz" <jgeretz@.nospam.com> wrote in message
news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
> It there an easy way to 'clean out' a SQL Server database? I need to get a
> database of an unknown state back to a known state of 'empty'. Is there an
> easy way to drop ALL structures; TABLES, VIEWS, SPROCS, FUNCTIONS,
> INDEXES, TRIGGERS, CONSTRAINTS, etc. (Did I miss anything?)
> (I don't want to rely on Dropping the Database and recreating it entirely
> as a new database, since this requires a priviledge escalation as compared
> to the priviledges required for working on structures inside of the
> database.)
> Thanks for your help!
> - Joseph Geretz -
>|||Joseph
you can back up an empty database, then restore the backup against the
database you wish to clean up
HIH|||> What are you actually trying to accomplish here? If you drop all of the
> database objects, what are you trying to preserve for future use?
I can't speak for the OP but I've done this in SQL 2000 as an alternative to
DROP/CREATE DATABASE. This is significantly faster when the database is
large. However, in SQL 2005, extent formatting is deferred so that reason
doesn't apply. In SQL 2005, DROP/CREATE is better/faster as long as the
user has CREATE DATABASE permissions.
Hope this helps.
Dan Guzman
SQL Server MVP
"Stephen Hendricks" <shendricks@.datalabs.com> wrote in message
news:uIUs5efHGHA.916@.TK2MSFTNGP10.phx.gbl...
> What are you actually trying to accomplish here? If you drop all of the
> database objects, what are you trying to preserve for future use?
> ========================================
==========
> People who want to share their religious views with you almost never
> want you to share yours with them. -Dave Barry, author and columnist
> (1947- )
> *** Sent via Developersdex http://www.examnotes.net ***|||Thanks Dan!
Your script works perfectly for us.
- Joe Geretz -
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:uhxmpBrHGHA.1088@.tk2msftngp13.phx.gbl...
> Here's a link to a script to drop all user objects using the basic
> technique Louis suggested. You can tweak for SQL 2005, although the need
> to do this might be mitigated if you can do DROP/CREATE DATABASE instead.
> http://tinyurl.com/9t9m6
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Joseph Geretz" <jgeretz@.nospam.com> wrote in message
> news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
>|||Nice :)
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:uhxmpBrHGHA.1088@.tk2msftngp13.phx.gbl...
> Here's a link to a script to drop all user objects using the basic
> technique Louis suggested. You can tweak for SQL 2005, although the need
> to do this might be mitigated if you can do DROP/CREATE DATABASE instead.
> http://tinyurl.com/9t9m6
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Joseph Geretz" <jgeretz@.nospam.com> wrote in message
> news:ezib0ueHGHA.2040@.TK2MSFTNGP14.phx.gbl...
>

Monday, March 19, 2012

choosing server and raid. -- Repost

1st sorry about repost but did not get any replies on my last post. Any
advice is grattly appriciated.
I'd like to get some feed back on what I can setup with these systems. I have
very limmited budget. One is primary server and the other is a
backup/recovery system. The intent is to setup logshipping between the two.
The database is currently 30 GB / data 4 GB Log and we expect it to grow 5
GB per year.
server (A) / primary server
DL380G3 server
Smart Array 5i Plus Controler
1 36 GB HD (currently OS and runtimes)
3 72 GB ULTRA320 10,000 rmp HD (currently everything else)
server (b) / backup/recovery
Dell PowerEdge 1600SC
PERC4 Single Channel
5 36 GB 15,000 rmp HD (raid 5) / 2 partitions (OS,database files)
My usumption
server (a) makeit the backup server
buy another 36 GB dribe and raid 1 with current
server (b)
buy another 36 GB harddrive
setup 2 HD in Raid 1 setup
setup 4 HD in raid 5 or raid 10 setup for database
? where should I place TEMPDB, transaction logs
What about backup of transaction log? should I partition the hard drives
jccondor wrote:
> server (A) / primary server
> DL380G3 server
> Smart Array 5i Plus Controler
> 1 36 GB HD (currently OS and runtimes)
> 3 72 GB ULTRA320 10,000 rmp HD (currently everything else)
The OS should be on a mirrored set if possible. That would require you
add another 36GB HD and set it up for RAID 1. Three disks does not leave
you with many options for the databases, log files, and tempdb. While
you can RAID 5 them, three disks is not ideal and having the data and
log files on the same array is not the best option either. Unless this
is a really small database with limited OLTP activity. So your
assumption about purchasing another 36GB drive sounds like a good idea.
If this is just for backups and are looking for the best write speed,
then a RAID 5 array is not the best choice since it has high overhead
for writing. But it may work for you if you need the redundancy. I
assume you want some redundancy on the disks and RAID 5 is the cheapest,
despite its write performance issues. Of course, if you only need
redundancy for the backups, then you could use one of the 72GB drives
for the OS, RAID 1 the other two and store backups there, and then move
the 36GB drive to the other server.

> server (b) / backup/recovery
> Dell PowerEdge 1600SC
> PERC4 Single Channel
> 5 36 GB 15,000 rmp HD (raid 5) / 2 partitions (OS,database files)
Partitioning a RAID 5 array into two partitions really gives you nothing
performance-wise. For best performance on a server, it's best to isolate
the OS/Program Files, the database files, and the log files. On a busy
server you can even isolate tempdb. It all depends on your database and
the type and level of activity. With 6 drives, you could use three RAID
1 arrays, a RAID 1 array for the OS and a RAID 1+0 for the database and
log files.
Since we know little about your database, the type of activity, the
level of activity, reads vs writes, the size, and the expected growth,
it's difficult to recommend a solution.
David Gugick
Quest Software
www.imceda.com
www.quest.com

choosing server and raid. -- Repost

1st sorry about repost but did not get any replies on my last post. Any
advice is grattly appriciated.
I'd like to get some feed back on what I can setup with these systems. I have
very limmited budget. One is primary server and the other is a
backup/recovery system. The intent is to setup logshipping between the two.
The database is currently 30 GB / data 4 GB Log and we expect it to grow 5
GB per year.
server (A) / primary server
DL380G3 server
Smart Array 5i Plus Controler
1 36 GB HD (currently OS and runtimes)
3 72 GB ULTRA320 10,000 rmp HD (currently everything else)
server (b) / backup/recovery
Dell PowerEdge 1600SC
PERC4 Single Channel
5 36 GB 15,000 rmp HD (raid 5) / 2 partitions (OS,database files)
My usumption
server (a) makeit the backup server
buy another 36 GB dribe and raid 1 with current
server (b)
buy another 36 GB harddrive
setup 2 HD in Raid 1 setup
setup 4 HD in raid 5 or raid 10 setup for database
? where should I place TEMPDB, transaction logs
What about backup of transaction log? should I partition the hard drivesjccondor wrote:
> server (A) / primary server
> DL380G3 server
> Smart Array 5i Plus Controler
> 1 36 GB HD (currently OS and runtimes)
> 3 72 GB ULTRA320 10,000 rmp HD (currently everything else)
The OS should be on a mirrored set if possible. That would require you
add another 36GB HD and set it up for RAID 1. Three disks does not leave
you with many options for the databases, log files, and tempdb. While
you can RAID 5 them, three disks is not ideal and having the data and
log files on the same array is not the best option either. Unless this
is a really small database with limited OLTP activity. So your
assumption about purchasing another 36GB drive sounds like a good idea.
If this is just for backups and are looking for the best write speed,
then a RAID 5 array is not the best choice since it has high overhead
for writing. But it may work for you if you need the redundancy. I
assume you want some redundancy on the disks and RAID 5 is the cheapest,
despite its write performance issues. Of course, if you only need
redundancy for the backups, then you could use one of the 72GB drives
for the OS, RAID 1 the other two and store backups there, and then move
the 36GB drive to the other server.
> server (b) / backup/recovery
> Dell PowerEdge 1600SC
> PERC4 Single Channel
> 5 36 GB 15,000 rmp HD (raid 5) / 2 partitions (OS,database files)
Partitioning a RAID 5 array into two partitions really gives you nothing
performance-wise. For best performance on a server, it's best to isolate
the OS/Program Files, the database files, and the log files. On a busy
server you can even isolate tempdb. It all depends on your database and
the type and level of activity. With 6 drives, you could use three RAID
1 arrays, a RAID 1 array for the OS and a RAID 1+0 for the database and
log files.
Since we know little about your database, the type of activity, the
level of activity, reads vs writes, the size, and the expected growth,
it's difficult to recommend a solution.
David Gugick
Quest Software
www.imceda.com
www.quest.com

choosing server and raid. -- Repost

1st sorry about repost but did not get any replies on my last post. Any
advice is grattly appriciated.
I'd like to get some feed back on what I can setup with these systems. I hav
e
very limmited budget. One is primary server and the other is a
backup/recovery system. The intent is to setup logshipping between the two.
The database is currently 30 GB / data 4 GB Log and we expect it to grow 5
GB per year.
server (A) / primary server
DL380G3 server
Smart Array 5i Plus Controler
1 36 GB HD (currently OS and runtimes)
3 72 GB ULTRA320 10,000 rmp HD (currently everything else)
server (b) / backup/recovery
Dell PowerEdge 1600SC
PERC4 Single Channel
5 36 GB 15,000 rmp HD (raid 5) / 2 partitions (OS,database files)
My usumption
server (a) makeit the backup server
buy another 36 GB dribe and raid 1 with current
server (b)
buy another 36 GB harddrive
setup 2 HD in Raid 1 setup
setup 4 HD in raid 5 or raid 10 setup for database
? where should I place TEMPDB, transaction logs
What about backup of transaction log? should I partition the hard drivesjccondor wrote:
> server (A) / primary server
> DL380G3 server
> Smart Array 5i Plus Controler
> 1 36 GB HD (currently OS and runtimes)
> 3 72 GB ULTRA320 10,000 rmp HD (currently everything else)
The OS should be on a mirrored set if possible. That would require you
add another 36GB HD and set it up for RAID 1. Three disks does not leave
you with many options for the databases, log files, and tempdb. While
you can RAID 5 them, three disks is not ideal and having the data and
log files on the same array is not the best option either. Unless this
is a really small database with limited OLTP activity. So your
assumption about purchasing another 36GB drive sounds like a good idea.
If this is just for backups and are looking for the best write speed,
then a RAID 5 array is not the best choice since it has high overhead
for writing. But it may work for you if you need the redundancy. I
assume you want some redundancy on the disks and RAID 5 is the cheapest,
despite its write performance issues. Of course, if you only need
redundancy for the backups, then you could use one of the 72GB drives
for the OS, RAID 1 the other two and store backups there, and then move
the 36GB drive to the other server.

> server (b) / backup/recovery
> Dell PowerEdge 1600SC
> PERC4 Single Channel
> 5 36 GB 15,000 rmp HD (raid 5) / 2 partitions (OS,database files)
Partitioning a RAID 5 array into two partitions really gives you nothing
performance-wise. For best performance on a server, it's best to isolate
the OS/Program Files, the database files, and the log files. On a busy
server you can even isolate tempdb. It all depends on your database and
the type and level of activity. With 6 drives, you could use three RAID
1 arrays, a RAID 1 array for the OS and a RAID 1+0 for the database and
log files.
Since we know little about your database, the type of activity, the
level of activity, reads vs writes, the size, and the expected growth,
it's difficult to recommend a solution.
David Gugick
Quest Software
www.imceda.com
www.quest.com

Sunday, March 11, 2012

choose from SQLDMO /SMO

in my classic ASP 3.0 application I would like to back up and restore SQL Express database. Should I use SQLDMO or SMO? Whats the difference?In classic ASP you'll have to stay with DMO, but remember that using DMO you won't be able to manage any of the new SQL Server 2005 features. If you expect to do that you'll have to upgrade your code to ASP.Net 2.0 and use SMO. I'd recommend the latter as DMO will not be supported in future releases of SQL Server.|||Thanks for your answer.I am using SQLDMO for backing up and restoring Sql Express database. While Restoring if i have any users connected to db ,restore fails.. Whats the solution for the problem? Do i need to Stop SQL Server ,restore and start again?|||You don't need to stop the server, just kill any connection to the database you're attempting to restore.|||

Allen,

I am using SQLDMO in my C# application for backing up and restoring MSDE
2000 database. Backup operations run fine, but Restoring fails. I've tried to KILL all the connections from the application but get the "cannot use KILL to kill your own process" error. Any ideas to solve this problem?
Thank you in advance for your help.
JC

|||Why I cannot use SMO in VBScript? Is there any limitation? I tried to use SMO in VBScript to connect to SQLExpress and got error :Object not found/object required. Is that the reason?|||VBScript uses COM for its object support and SMO uses the .Net Framework. The only server you can use VBScript to communicate with SMO is the default local instance of SQL Server, and SQL Express usually installs itself in a named instance called SQLExpress.|||Hello Everyone

i have one question please answer if you know, what is my requirement is if i supply the SQL server name i want all the available instances in that sql server for that i m writing code in C#

way no:
1).
ManagedComputer mc = new ManagedComputer(SystemName);
foreach (ServerInstance si in mc.ServerInstances)
{
lstInstanceNames.Items.Add(si.Name);
}

2).
DataTable dtSQLServers = SmoApplication.EnumAvailableSqlServers(servername);
foreach (DataRow drServer in dtSQLServers.Rows)
{
InstanceName = drServer["Instance"].ToString();
}

none of these are working please help me solve this problem