I have sql 2000 server and sql2005server running on the same box right
now. I want to start upgrading my sql 2000 databases to sql2005. What is
the best way to do this?
Curious how we’re getting the data you see in SQL Developer when you click on something? While many of the dialogs provide a ‘SQL’ panel that shows you the SQL ABOUT to be generated, I’d rather see the SQL AS it’s executed.
True, you could set a TRACE or fire up a Monitor Sessions report, but both of those solutions leave me hungry for more.
Did you know that SQL Developer has a ‘debug’ mode? It slows the tool down a bit and spits out a lot of information you don’t care about, but it ALSO shows you ALL the SQL that is sent to the database, as you click around the tool!
See ALL the SQL that SQL Developer sends to the database on your behalf
Enable DEBUG Mode
When you see the splash screen as SQL Developer fires up, frantically hit Up, Up, Down, Down, Left, Right, Left, Right, B, A, SELECT, Start.
Wait, wrong game.
No, all you need to do is go to your SQL Developer directory and navigate down to the ‘bin’ directory. In that directory, find the ‘sqldeveloper.conf’ file.
Install Directory - sqldeveloper - bin - sqldeveloper.conf
Open it with a text editor.
Find this line
IncludeConfFile sqldeveloper-nondebug.conf
And replace it with this line
IncludeConfFile sqldeveloper-debug.conf
Save the file.
Start up SQL Developer.
Observe the Logging Page – Log Panel for the SQL
There’s going to be more than just SQL here. You’ll actually see a LOT of other information. If you’re having general problems with the tool and you want to see the nitty-gritty of what’s going on, then this is a good place to satisfy your curiosity and might help us diagnose your issue if you post to the forums or open a ticket with My Oracle Support.
You’ll find ‘INFO’ entries that look a little something like this -
This is the query used to populate your Tables list in the connection tree.
You can double-click on the sql text and get a pop-up window that’s much easier to read.
See all that typing we’re saving you?
I don’t recommend running in DEBUG mode all the time. Capturing this information and displaying it is more expensive than not doing so. And it provides a lot of information you don’t normally need to see. But when you DO want to know what’s going on and why, this is an excellent way of getting that information.
When you’re ready to go back to ‘normal’ mode, just close SQL Developer, go back to your .conf file, and add the ‘nondebug’ bit back.
SQL Server 2012 supports SHA-256 and SHA-512 through the HASHBYTES() function, but earlier versions of SQLServer do not. SHA-256, SHA-384 and SHA-512 can, however, be implemented in SQLServer2005 or SQLServer 2008 with the CLR assembly described in this article.
Optimize SQLServer performance“With SQL Monitor, we can be proactive in our optimization process, instead of waiting until a customer reports a problem,” John Trumbul, Sr. Software Engineer. Optimize your servers with a free trial.
I've just upgraded an existing SQLServer2005 to 2008 by running the installer (not the platform installer). It all seems to have worked - there were no errors reported and my code that connects to these databases still works fine.
The problem is, when I try installing SQLServer Management Studio Express 2008 I am shown then following error message when I select to add new features to an existing instance of SQLServer 2008:
The SQLServer instance 'SQL1MINUS102'
already has an Instance ID '2' that is
different than the specified Instance
ID 'SQL1MINUS102'. Specifying more
than one instance ID for the same SQLServer instance is not supported.
Here is a screenshot of the installation dialog and the setup discovery report:
Screenshot
Notice that there are two instances with the same name. So any ideas how I should recifiy this so that I can install Management studio?
Thanks in advance
I have a pair of SQL Servers at different webhosts, and I'm looking for a way to periodically update the one server using the other. Here's what I'm looking for:
As automated as possible - ideally, without any involvement on my part once it's set up.
Pushes a number of databases, in their entirely (including any schema changes) from one server to the other
Freely allows changes on the source server without breaking my process. For this reason, I don't want to use replication, as I'd have to break it every time there's an update on the source, and then recreate the publication and subscription
One database is about 4GB in size and contains binary data. I'm not sure if there's a way to export this to a script, but it would be a mammoth file if I did.
Originally, I was thinking of writing something that takes a scheduled full backup of each database, FTPs the backups from one server to the other once they're done, and then the new server picks it up and restores it. The only downside I can see to this is that there's no way to know that the backups are done before starting to transfer them - can these backups be done synchronously? Also, the server being refreshes is our test server, so if there's some downtime involved in moving the data, that's fine.
Does anybody out there have a better idea, or is what I'm currently considering the best non-replication way to go? Thanks for your help, everybody.
UPDATE:
I ended up designing a custom solution to get this done using BAT files, 7Zip,command line FTP, and OSQL, so it runs in a completely automatic way and aggregates the data from a dozen servers across the country. I've detailed the steps in a blog entry.
Thanks for all your input!
I have both a dedicated and a VPS (from Fasthosts) virtual server - the web sites/applications I run on these, access SqlServer stored on the same web server.
Until now, I have logged onto SqlServer on both the deidicated and VPS server, from SqlServer Management Studio - until I noticed in my server application logs, multiple attempts to logon to SqlServer using the 'sa' username, but failed password.
So someone/bot is trying hard (repeatedly every couple of hours, for approx 20 attempts during each instance) to log on... so obviously I have to lock down access to Sql Sever remotely.
What I have done is gone into Configuration Manager, and in SqlServer Network Configuration - Protocols for Sql2008 and also in Sql Native Client 10.0 Configuration - Client Protocols - I have diabled Named Pipes, TCP/IP (and VIA by default). I have left Shared Memory enabled. I also disabled in SqlServer Services, the SqlServer Browser.
Now the only way I can manage the databases on these servers, is by logging on to them via Remote Desktop.
Can anyone confirm if this is the correct way of stopping anyone maliciously logging on to Sql Server? (I'm not a DBA or security expert - and there are hundreds of articles advising all different ways - but I was hoping for the experts here to confirm, or otherwise, if what I've done is correct)
Thank you,
Mark
I am currently using SQLServer2005 and (undocumented I believe) master..xp_fixeddrives to get free space on my database volumes as part of my monitoring.
However, this only gives me an absolute number of MB free. What I really need is percentage free.
Is there another way in SQLServer2005 to get this? If not, is there some other light-weight way to get it? If I can, I want to avoid installing a Java JRE, or Perl, or Python on my database server. Perhaps vbscript, or a small Windows executable on the file system?
Yes, I know I can Google this, and I have. It looks like there are a few ways to accomplish it, and I'm curious how my DBA brethren have handled this.
I have a report with cascading parameters. The first parameter is Finanical Period Type, being either Month or Week. The second parameter is a list of either financial months or weeks depending on what was selected for the first parameter. This all works well and selecting a series of different Financial Period Types in sequence correctly updates the second parameter's values.
However I now wish to add a default value for the second parameter, which is once again dependent on the first parameter. So I've added an additional field to the dataset populating the second parameter called DefaultPeriod and set the second parameter's default value to be retrieved from the above field.
The first time I select the Financial Period Type, the default is correctly set. However changing the Financial Period Type results in an updated list for the second parameter, but the default is incorrect. It remains set to the original default value, even thought the dataset has been refresh and the DefaultPeriod field is correct.
This is both an issue in the IDE and on the Report Manager site.
Hi,
I want to change the build system path for building my VC++ project in VS2005.
When I try to build the project, I'm getting an error that a specified header file cannot be opened. I have that header file in "Microsoft SDKs\Windows\v7.0\Include".
But the path present in 'Build system path' is "Microsoft SDKs\Windows\v7.0\Include" which i found in the Error dialog box when i tried to open that header file through the code.
So I want to change the path in build system path to "Microsoft SDKs\Windows\v7.0\Include".
How can i do this.? How to open Build system paths in VS2005.?
Is there a way to navigate between tabs in VS similar to the emacs iswtichb-mode or Firefox ubiquity switch tab mode (https://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.1_Author_Tutorial#Switching_Tabs) ?
In these apps, you just type a substring of the title of the tab (or buffer for emacs) to switch to this tab. For instance, to switch to a tab named "App_Code/Data/MyProgram.cs", you just invoke the tab switching command and then type "Progr" for instance to list all the tab whose name matches this string, including "MyProgram.cs".
It's much easier to switch between tabs this way when you have a lot of documents open and when you now where to go (which is the case in most situation)
Thank you !
Im trying to execute a stored procedure and simply insert its results in a temporary table, and I'm getting the following message:
The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "MyServerName" was unable to begin a distributed transaction. OLE DB provider "SQLNCLI" for linked server "MyServerName" returned message "No transaction is active.".
My query looks like this:
INSERT INTO #TABLE
EXEC MyServerName.MyDatabase.dbo.MyStoredProcedure Param1, Param2, Param3
Exact column number, names, the problem is not the result.
MSDTC is allowed and started in both computers, Remote procedure calling too.
The machines are not in the same domain, but I can execute remote queries from my machine and get the result. I can even execute the stored procedure and see its results, I just can't insert it in another table.
Help, please? :)
Hi,
I have a table, and it is returning the data as -
Column1 Column2 Column3 Column4 Column5 Column6
-------------------------------------------------------------------
6 Joy Mycity NZ 123456 [email protected]
I need to disply it as -
SingleColumn
-----------------------
6
joy
mycity
NZ
123456
[email protected]
How do I do it?
Hi all
I've searched up and down Google for others with a similar problem, and while I can find the error I don't think that other people have the same base problem that I do.
Basically, I had to create a project for a unit-testing environment in order to run this test suite.
First, I add my original C file, compile, and then a test file (C++) is generated. I then exclude my original source from the project, include this test script (which includes the original source at the top), and then run.
I can debug the test file fine, but when it jumps to the original C file I get the dreaded 'no source code available for the current location' error.
Both files are located within the same location, and I compiled the original file without any issue.
Anybody have any thoughts about this? Its driving me crazy!
Hi,
I have a table in which there are two columns : 1. import type, 2. Excel import template.
The second column - "Excel import template" should store the whole excel file.
How would I save excel file in databse...can I use binary datatype column, convert excel file to bytes and save the same ?
Thanks in advance !
Context
I am fairly new to database design (=know the basics) and am grappling with how best to design my database for a project I am currently working on.
In short, my database will keep a log of which employees have attended certain health and safety courses throughout the year. There are multiple types of course e.g. moving objects, fire safety, hygiene etc.
In terms of my database design I need to accommodate the following:
Each location can have multiple
divisions
Each division can have multiple
departments
Each department can have multiple
functions
Each function can have multiple job
roles
Each job role can have different
course requirements
Also note that the structure at each location may not be the same e.g. the departments within divisions are not the same across locations and the functions within departments may also differ.
Edit - updated to better articulate problem
Let's assume I am just looking at Location, Division and Department and I have my database as follows:
LocationTable DivisionTable DepartmentTable
LocationID(PK) DivisionID(PK) DepartmentID(PK)
LocationName DivisionName DepartmentName
There is a many-to-many relationship between Locations and Divisions and also between Departments and Divisions.
Suppose I set up a 'Junction Table' as follows:
Location_Division
LocationID(FK)
DivisionID(FK)
Using Location_Division I could easily pull back the Divisions for any Location.
However, suppose I want to pull back all departments for a given Division in a given Location.
If I set up another 'Junction Table' for Division and Department then I can't see how I would differentiate Division by Location?
Division_Department
DivisionID(FK)
DepartmentID(FK)
Location_Division Division_Department
LocationID DivisionID DivisionID DepartmentID
1 1 1 1
1 2 1 2
2 1 2 1
2 2 2 2
Do I need to expand the number of columns in my 'Junction Table' e.g.
Location_Division_Department
LocationID(FK)
DivisionID(FK)
DepartmentID(FK)
Location_Division_Department
LocationID DivisionID DepartmentID
1 1 1
1 1 2
1 1 3
2 1 1
2 1 2
2 1 3
Note
I have completely re-written my original post to better explain the issue I am trying to understand. I have tried to generalise the problem as much as possible.
Also, my thanks to the original people who responded. Hopefully this post makes things a little clearer.
Context
In short, I am struggling to understand the best way to design a small scale database to handle (what I perceive to be) multiple many-to-many relationships.
Imagine the following scenario for a company organisational structure:
Textile Division Marketing Division
| |
---------------------- ----------------------
| | | |
HR Dept Finance Dept HR Dept Finance Dept
| | | |
---------- ---------- ---------- ---------
| | | | | | | |
Payroll Hiring Audit Tax Payroll Hiring Audit Accounts
| | | | | | | |
Emps Emps Emps Emps Emps Emps Emps Emps
NB: Emps denotes a list of employess that work in that area
When I first started with this issue I made four separate tables:
Divisions - Textile, Marketing (PK = DivisionID)
Departments - HR, Finance (PK = DeptID)
Functions - Payroll, Hiring, Audit, Tax, Accounts (PK = FunctionID)
Employees - List of all Employees (PK = EmployeeID)
The problem as I see it is that there are multiple many-to-many relationships i.e. many departments have many divisions and many functions have many departments.
Question
Giving the database structure above, suppose I wanted to do the following:
Get all employees who work in the Payroll function of the Marketing Division
To do this I need to be able to differentiate between the two Payroll departments but I am not sure how this can be done?
I understand that I could build a 'Link / Junction' table between Departments and Functions so that I can retrieve which Functions are in which Departments. However, I would still need to differentiate the Division they belong to.
Research Effort
As you can see I am an abecedarian when it comes to database deisgn. I have spent the last two days resaerching this issue, traversing nested set models, adjacency models, reading that this issue is known not to be NP complete etc. I am sure there is a simple solution?
I have a table in which there are two columns : 1. import type, 2. Excel import template.
The second column - "Excel import template" should store the whole excel file.
How would I save excel file in databse...can I use binary datatype column, convert excel file to bytes and save the same ?
Thanks in advance !
Adding a seemingly perfectly index is having an unexpectedly adverse affect on a query performance...
-- [Data] has a predictable structure and a simple clustered index of the primary key:
ALTER TABLE [dbo].[Data] ADD PRIMARY KEY CLUSTERED ( [ID] )
-- My query, joins on itself looking for a certain kind of "overlapping" records
SELECT DISTINCT
[Data].ID AS [ID]
FROM
dbo.[Data] AS [Data]
JOIN
dbo.[Data] AS [Compared] ON
[Data].[A] = [Compared].[A] AND
[Data].[B] = [Compared].[B] AND
[Data].[C] = [Compared].[C] AND
([Data].[D] = [Compared].[D] OR [Data].[E] = [Compared].[E]) AND
[Data].[F] <> [Compared].[F]
WHERE 1=1
AND [Data].[A] = @A
AND @CS <= [Data].[C] AND [Data].[C] < @CE -- Between a range
[Data] has about a quarter-million records so far, 10% to 50% of the data satisfies the where clause depending on @A, @CS, and @CE. As is, the query takes 1 second to return about 300 rows when querying 10%, and 30 seconds to return 3000 rows when querying 50% of the data.
Curiously, the estimated/actual execution plan indicates two parallel Clustered Index Scans, but the clustered index is only of the ID, which isn't part of the conditions of the query, only the output. ??
If I add this hand-crafted [IDX_A_B_C_D_E_F] index which I fully expected to improve performance, the query slows down by a factor of 8 (8 seconds for 10% & 4 minutes for 50%). The estimated/actual execution plans show an Index Seek, which seems like the right thing to be doing, but why so slow??
CREATE UNIQUE INDEX [IDX_A_B_C_D_E_F]
ON [dbo].[Data] ([A], [B], [C], [D], [E], [F])
INCLUDE ([ID], [X], [Y], [Z]);
The Data Engine Tuning wizard suggests a similar index with no noticeable difference in performance from this one. Moving AND [Data].[F] <> [Compared].[F] from the join condition to the where clause makes no difference in performance.
I need these and other indexes for other queries. I'm sure I could hint that the query should refer to the Clustered Index, since that's currently winning - but we all know it is not as optimized as it could be, and without a proper index, I can expect the performance will get much worse with additional data.
What gives?
Here is my scenario, I'm creating a dynamic query using a select statement which uses functions to generate the query. I am storing it into a variable and running it using exec. i.e.
declare @dsql nvarchar(max)
set @dsql = ''
select @dsql = @dsql + dbo.getDynmicQuery(column1, column2)
from Table1
exec(@dsql)
Now it produces the many errors in this scenario, like 'Incorrect syntax near ','' and 'Case expressions may only be nested to level 10.'
But if i take the text from @dsql and assign it a variable manually like:
declare @dsql nvarchar(max)
set @dsql = ''
set @dsql = N'<Dynamic query text>'
exec(@dsql)
it runs and generates the result, what could be the reason for that ??
Thanks..
Hi Guys,
i tried to open the website from broswer project is deployed at IIS i am getting this exception
Exception information:
Exception type: SqlException
Exception message: Cannot open database "TestDB" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.
any solution?
Regards
kumar