Showing posts with label instance. Show all posts
Showing posts with label instance. Show all posts

Sunday, March 25, 2012

Cleaning up data files when removing instance (integr. inst.)

Hi everyone,

I'm trying to integrate SQLEXPRESS in a custom application ("the app"). On installation, a new instance ("myNewInstance") is created, and a new DB ("myDB") is created on that instance.

Upon de-installation of "the app", I remove the new instance. To that end, I'm calling the SQLEXPRESS setup like this:

Code Snippet

setup.exe /qb REMOVE=SQL_Engine INSTANCENAME=myNewInstance


The Problem: While the service and the instance are removed, the instance's data directory is not, and the DB Datafiles are still there. Now if I reinstall the app (re-creating myNewInstance), it uses the same directory structure, and when I try to re-create the DB, I get the following error message:

Code Snippet

Msg 5170, Level 16, State 1, Line 1
Cannot create file '[...]\MSSQL.2\MSSQL\DATA\myDB.mdf' because it already exists. Change the file path or the file name, and retry the operation.


So here's the Question: is there
a) any way to tell setup.exe to completely remove the datafiles when uninstalling the instance, or
b) any way to tell TSQL to overwrite the old datafiles if they exist?

Thanks in advance,
Thorsten

hi Thorsten,

AFAIK, the setup/uninstall wizard does not provide a way to delete user's database, and this usually is a good thing as user's databases are actually the "real important things" to be preserved.. a setup option, SAVESYSDB=0/1 extend that feature to system databases as well, that are usually deleted in normal uninstall situations.. but "the contrary" is not available... but you can probably add a custom task to your uninstall (I do think via ORCA) to delete all "orphaned" remaining files...

regards

Thursday, March 22, 2012

Class Reference - Constructor with Arguments?

From the references tab, I see I can create an instance reference, but I do
not see how I can instantiate that class with a constructor that has
arguments. Does it only do the default New() constructor?
I would like something like: m_MyClass = New MyClass(Version as Integer)I have not found a way to do this. I will perform further research on it
and update you once I have more information.
Sincerely,
William Wang
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi David,
In the Reference tab of report properties, if we specify a instance name we
can only use the default constructor. If you need something other than the
default constructor, you can instantiate the class in the <Code> property
of the report instead. You'll need to reference the assembly on the
References tab of the report properties, but you would't declare an
instance there.
Instead, you'd declare the instance and initialize it in the Code property:
For example,
Dim m_myClass As MyClass
Protected Overrides Sub OnInit()
m_myClass = new MyClass(1234)
End Sub
Sincerely,
William Wang
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
This posting is provided "AS IS" with no warranties, and confers no rights.

Sunday, March 11, 2012

Choose a named instance port(firewall).

Hi all,
i am installing a named instance in a DMZ.
Now i can choose for udp 1434 for the sqlbrowser srevice but the
Firwall/secutiry boys aren't happy about that.
So now i think i will configure it with a fixed tcp/ip port.
Wat port can i choose?
Eg. 1500 or 50000?
anyone?!
What port did you use?!
Thx!Hello Hate_orphaned_users,

> Hi all,
> i am installing a named instance in a DMZ.
> Now i can choose for udp 1434 for the sqlbrowser srevice but the
> Firwall/secutiry boys aren't happy about that.
> So now i think i will configure it with a fixed tcp/ip port.
> Wat port can i choose?
> Eg. 1500 or 50000?
> anyone?!
> What port did you use?!
> Thx!
>
See:
http://support.microsoft.com/kb/287932
I'd just configure it to use TCP 1434. a different port is just security
by obscurity. Poeple who want in will be able to find the port regardless
of the fact that you changed the number. And if anyone comes knocking, SQL
will happily tell them what it actually is.
Jesse|||Yes, i now.
But if i should configure a static tcp/ip port for the named instance which
one should i choose?Or what port is recommended.?
Cheers,
Harry|||> But if i should configure a static tcp/ip port for the named instance
> which
> one should i choose?Or what port is recommended.?
Any port not already in use?
Aaron Bertrand
SQL Server MVP|||Lol. That simple.Yup yup.
Thx. That answered my question.

Choose a named instance port(firewall).

Hi all,
i am installing a named instance in a DMZ.
Now i can choose for udp 1434 for the sqlbrowser srevice but the
Firwall/secutiry boys aren't happy about that.
So now i think i will configure it with a fixed tcp/ip port.
Wat port can i choose?
Eg. 1500 or 50000?
anyone?!
What port did you use?!
Thx!Hello Hate_orphaned_users,
> Hi all,
> i am installing a named instance in a DMZ.
> Now i can choose for udp 1434 for the sqlbrowser srevice but the
> Firwall/secutiry boys aren't happy about that.
> So now i think i will configure it with a fixed tcp/ip port.
> Wat port can i choose?
> Eg. 1500 or 50000?
> anyone?!
> What port did you use?!
> Thx!
>
See:
http://support.microsoft.com/kb/287932
I'd just configure it to use TCP 1434. a different port is just security
by obscurity. Poeple who want in will be able to find the port regardless
of the fact that you changed the number. And if anyone comes knocking, SQL
will happily tell them what it actually is.
Jesse|||Yes, i now.
But if i should configure a static tcp/ip port for the named instance which
one should i choose?Or what port is recommended.?
Cheers,
Harry|||> But if i should configure a static tcp/ip port for the named instance
> which
> one should i choose?Or what port is recommended.?
Any port not already in use?
--
Aaron Bertrand
SQL Server MVP|||Lol. That simple.Yup yup.
Thx. That answered my question.

Choose a named instance port(firewall).

Hi all,
i am installing a named instance in a DMZ.
Now i can choose for udp 1434 for the sqlbrowser srevice but the
Firwall/secutiry boys aren't happy about that.
So now i think i will configure it with a fixed tcp/ip port.
Wat port can i choose?
Eg. 1500 or 50000?
anyone?!
What port did you use?!
Thx!
Hello Hate_orphaned_users,

> Hi all,
> i am installing a named instance in a DMZ.
> Now i can choose for udp 1434 for the sqlbrowser srevice but the
> Firwall/secutiry boys aren't happy about that.
> So now i think i will configure it with a fixed tcp/ip port.
> Wat port can i choose?
> Eg. 1500 or 50000?
> anyone?!
> What port did you use?!
> Thx!
>
See:
http://support.microsoft.com/kb/287932
I'd just configure it to use TCP 1434. a different port is just security
by obscurity. Poeple who want in will be able to find the port regardless
of the fact that you changed the number. And if anyone comes knocking, SQL
will happily tell them what it actually is.
Jesse
|||Yes, i now.
But if i should configure a static tcp/ip port for the named instance which
one should i choose?Or what port is recommended.?
Cheers,
Harry
|||> But if i should configure a static tcp/ip port for the named instance
> which
> one should i choose?Or what port is recommended.?
Any port not already in use?
Aaron Bertrand
SQL Server MVP
|||Lol. That simple.Yup yup.
Thx. That answered my question.

Thursday, March 8, 2012

Cheking if report's rendering in excel

Hi,
Is there a way to use an expression to check if the report is in html or
Excel?
For instance, for displaying in html I could want some format, but in Excel
not.
Is there a way to test something like this':
=iif(ReportExcel, "GainsBoro", "White")
The part of ReportExcel, to test if Iâ'm in excel is the one I want to know
(ReportExcel should be an expression, that returns true of false).
Would be also nice to see if Iâ'm in html.
Basically, I want to avoid Actions in the excel file.
Thanks in advance,
Santiago E. ReilWhat you could do is have an extra parameter passed to the report lets say we pass temp.
Depending on if you are rendering in excel or HTML format pass 0 or 1 for the parameter.
Now you can use the value of temp to see if you are rendering in excel or HTML.
>--Original Message--
>Hi,
>Is there a way to use an expression to check if the report is in html or >Excel?
>For instance, for displaying in html I could want some format, but in Excel >not.
>Is there a way to test something like this':
>=3Diif(ReportExcel, "GainsBoro", "White")
>The part of ReportExcel, to test if I=E2?Tm in excel is the one I want to know >(ReportExcel should be an expression, that returns true of false).
>Would be also nice to see if I=E2?Tm in html.
>Basically, I want to avoid Actions in the excel file.
>Thanks in advance,
>Santiago E. Reil
>.
>

Thursday, February 16, 2012

Checking for an instance of DTS packages

Does anyone know of a way to check for an instance of a DTS package?

E.g. I have a package called 'Package1' that is currently running.
Someone else attempts to run the package and before they can i want to check if an instance of 'Package1' already exists, if it does then the package will not run.

possible or pipedream?

cheers

tomIdentifying if an instance of your package is already running via the DTS object is not an easy or straightfoward issue. But you could easily get round it by using a global variable in your package. Assign it a value as soon as the package kicks off, hold the value and either kill the variable or assign it another variable when the package has finished running. Test the global variable and thereby decide whether to continue running the package or not.

I however admit I have never actually had to do this.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dtsprog/dtspapps_64z0.asp|||Yes i had thought of a similar idea of just setting an in-use flag stored in an .ini file or something.

just wondered if there was a slick way to do it that all.

Thanks for the advice, mucho appreciated.

t

Friday, February 10, 2012

check sql server edition

is there a way to get the edition(e.g. sqlexpress,enterprise etc...) of an installed sql server instance in your local machine programatically?

Code Snippet

select serverproperty('Edition')

HTH!|||alright! thanks man! Smile but is there some other way... without executing a query from the server?|||

I guess another way would be to query the registry for the information. Looking around there appears to be that information in the registry key for SQL2005:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\Edition

HTH!

|||

i've checked my registry... but it seems its not correct to read the registry when checking an installed sqlserver edition... it's not accurate..my machine have some previous sqlserver installations before and my registry looks like this..

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\Setup\Edition\Developer Edition

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.2\Setup\Edition\DeveloperEdition

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.3\Setup\Edition\Express Edition

...

...

......

.........

............

...............

but there is only one developer edition instance installed in my machine...

|||

Hi,

I guess your registry showing is correct.

During SQL Server Setup, an instance ID is generated for each server component. The server components in this SQL Server release are the Database Engine, Analysis Services, and Reporting Services. The instance ID is in the format MSSQL.n, where n is the ordinal number of the component being installed. The instance ID is used in the file directory and the registry root.

The first instance ID generated is MSSQL.1; ID numbers are incremented for additional instances as MSSQL.2, MSSQL.3, and so on. If gaps occur in the ID sequence due to uninstalls, ID numbers are not generated to fill them. The most recently installed instance always has the highest instance ID number.

Server components are installed in directories with the format <instanceID>\<component name>. For example, a default or named instance with the Database Engine, Analysis Services, and Reporting Services would have the following default directories:

<Program Files>\Microsoft SQL Server\MSSQL.1\MSSQL\ for the Database Engine

<Program Files>\Microsoft SQL Server\MSSQL.2\OLAP\ for Analysis Services

<Program Files>\Microsoft SQL Server\MSSQL.3\RS\ for Reporting Services