Trigger to populate table in sql server database
Maybe this isn't the right board to post this in, but here goes:
We have an Oracle 9i database, with a table that get's populated with a new record every minute or so.
We need to take some values from the newly inserted record and populate a table in a sql server database instantly. The people requesting this have not said as much, but I am thinking deletes and updates would need to be the same.
How would it be best to do this? My first thought was a trigger on the oracle table that populates the sql server table via heterogeneous db link.
Any other ideas?
thanks in advance..
update- repost in heterogeneous forum
Edited by: user571263 on Mar 15, 2011 11:25 AM
Maybe this isn't the right board to post this inI think you are right:
Heterogeneous Connectivity
Werner
Similar Messages
-
How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
I tried using DROP Tables, Truncate Database, Delete and many more but it is not working. I want to delete all tables using Query Analyzer, i.e. through SQL Query.
Please help me out in this concern.
Nishith ShahInformative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
declare @TTName Table
(TableSchemaTableName
varchar
(500),
[status] int
default 0);
with AvailableTables
(TableSchemaTableName)
as
(select
QUOTENAME(TABLE_SCHEMA)
+
+
QUOTENAME(TABLE_NAME)
from
INFORMATION_SCHEMA.TABLES)
insert into @TTName
(TableSchemaTableName)
select *
from AvailableTables
declare @TableSchemaTableName varchar
(500)
declare @sqlstatement nvarchar
(1000)
while 1=1
begin
set @sqlstatement
=
'DROP TABLE '
+ @TableSchemaTableName
exec
sp_executeSQL
@sqlstatement
print
'Dropped Table : '
+ @TableSchemaTableName
update @TTName
set [status]
= 1
where TableSchemaTableName
= @TableSchemaTableName
if
(select
count([Status])
from @TTName
where [Status]
= 0)
= 0
break
end -
Loading data from SAS tables to SQL server database
Hi Guys
I am championing a BI Proof of Concept project to create a self-service BI platform using tabular model parallel to our traditional BI platform on SAS.
I need to load certain SAS tables to SQL server database so I can start creating reports in SSAS. Appreciate if anyone can suggest the process that I can load the files to database engine as a scheduled job.
Appreciate your feedback and if further info needed please ask.
Cheers
MarkFrom VB6 there is not much alternative than to send row by row which indeed is slow.
But you could write a C# application which uses a table-valued parameter to load the data, and this could be streamed so that the client never has the hold the entire file. I have an example of this in this article on my web site:
http://www.sommarskog.se/arrays-in-sql-2008.html
You can also use the SqlBulkCopy class, but I don't have any example of this myself.
Erland Sommarskog, SQL Server MVP, [email protected] -
Can Oracle view refer a table in Sql Server Database
Can a view created in Oracle database refer a table created in SQL Server database. If yes, how do we do it. Code will be very help full.
Again, if yes does it require any special software and what would be price of that software.
Thanks for your response in advance.
Venkat SathiamurthyYou would need to configure Oracle Heterogeneous Connectivity to create a database link to the SQL Server system. This can either be done via the Oracle Transparent Gateway for Microsoft SQL Server, which retails for $15,000 per server at http://store.oracle.com or by configuring Oracle Generic Connectivity and using ODBC to go after the SQL Server data. Depending on the operating system you run Oracle on, there may be a free (or cheap) ODBC driver for SQL Server that could be used.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How to update or populate table in SQL server from PL/SQL
Hello - I am starting in the fascinating world of PL/SQL. One of the first task I've been assigned is to rewrite a code (basically I was thinking of creating a package with proc included) on PL/SQL that updates and/or populates tables in MS SQL Server. How should I do this? Is it doable? I guess it is. How can I call tables from others databases from PL/SQL? How to establish the conecction? where? It should be included in the package?
Any help will be appreciated
Thanks,
CCSee PL\SQL and SQL Server
-
Hi,
I have to implement the following scenario in SSIS but don't know how to do since I never worked with SSIS before. Please help me.
I have 20 different text files in a single folder and 20 different tables corresponding to each text file in SQL Server 2008 R2 Database. I need to extract the data from each text file and
load the data into corresponding table in Sql Server Database. Please guide me in how many ways I can do this and which is the best way to implement this job. Actually I have to automate this job. Few files are in same format(with same column names
and datatypes) where others are not.
1. Do I need to create 20 different projects ?
or
Can I implement this in only one project by having 20 packages?
or
Can I do this in one project with only one package?
Thanks in advance.As I said I don't know how to use object data type, I just given a shot as below. I know the following code has errors can you please correct it for me.
Public
Sub Main()
' Add your code here
Dim f1
As FileStream
Dim s1
As StreamReader
Dim date1
As
Object
Dim rline
As
String
Dim Filelist(1)
As
String
Dim FileName
As
String
Dim i
As
Integer
i = 1
date1 =
Filelist(0) =
"XYZ"
Filelist(1) =
"123"
For
Each FileName
In Filelist
f1 = File.OpenRead(FileName)
s1 = File.OpenText(FileName)
rline = s1.ReadLine
While
Not rline
Is
Nothing
If Left(rline, 4) =
"DATE"
Then
date1 (i)= Mid(rline, 7, 8)
i = i + 1
Exit
While
End
If
rline = s1.ReadLine
End
While
Next
Dts.Variables(
"date").Value = date1(1)
Dts.Variables(
"date1").Value = date1(2)
Dts.TaskResult = ScriptResults.Success
End
Sub -
Hello team,
I have a project that I need to do, what is the best approach for each step?
1- I have to create a table in Microsoft SQL Server.
2- I have to import data/ tables from Microsoft Excel or Access to Microsoft SQL Server. Should I use Microsoft Visual Studio to move data from Excel or Access?
3-I should populate the created table with the data from the exported data.
4-How should I add the second and third imported table to the first table? Should I use union query?
After I learn these, I will bring up the code to make sure what I do is right.
Thanks for all,
Guity
GGGGGNNNNNHello Naomi,
I have imported all the tables into SQL Server,
I created a table:
CREATE
TABLE dbo.Orders
Now I want to populate this table with the values from imported tables, will this code take care of this task?
INSERT INTO dbo.Orders(OrderId, OrderDate)
SELECT OrderId, OrderDate
FROM Sales.Orders
UNION
SELECT OrderId, OrderDate
FROM Sales.Orders1
Union
SELECT OrderId, OrderDate
FROM Sales.Orders2
If not, what is the code?
Please advise me.
GGGGGNNNNN
GGGGGNNNNN -
How to transfer database tables from sql server 2000 to oracle 10g
Hi,
I have a database and tables in sql server 2000. I have to transfer those data to Oracle 10g. I have installed Oracle warehouse Builder ETL Tool. Using this how can i transfer data. Any help is vary helpful for me.
Thanks in advance.you have to do it using ODBC HS.
1. Configure ODBC connection through gateway.
2. Create a initxxx.ora file with HS config.
restart gateway listener services
3. on target o/s add entries to your tnsnames.ora
4. On your target o/s create a db link
restart listener on target
cheeck this out.Non-Oracle connection through HS issue
Edited by: Darthvader-647181 on Jan 29, 2009 2:02 AM -
My Experiences re: Migrating SQL Server Database to Oracle
I am using SQL Developer EA4 for thsi conversion, best attempt yet.
I had numerous problems with this conversion.
1. The wizard asked me to specify the new Oracle database; instead it just ignored this information and created an Oracle database similarly named as the SQL Server database. I also noticed a file name "Migration.out" was produced; it contained errors such as:
Error starting at line 3 in command:
CREATE USER Emulation IDENTIFIED BY Emulation DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP
Error at Command Line:3 Column:36
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges" and
Error starting at line 4 in command:
GRANT CREATE SESSION, RESOURCE, CREATE VIEW, CREATE MATERIALIZED VIEW, CREATE SYNONYM,CREATE PUBLIC SYNONYM TO Emulation
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges" and
Error starting at line 7 in command:
CREATE USER dbo_COREv13 IDENTIFIED BY dbo_COREv13 DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP
Error at Command Line:7 Column:38
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges" and
Error starting at line 8 in command:
GRANT CREATE SESSION, RESOURCE, CREATE VIEW, CREATE MATERIALIZED VIEW, CREATE SYNONYM TO dbo_COREv13
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges".
I followed all of the steps listed in the "Help" section re: Migrations but still ended up with these errors.
2. My schema consists of 1000+ tables; approximately 10 tables were NOT created. When I copied the SQL from Migration.sql making NO changes and pasted it into the new Oracle database it created without issues.
3. While the conversion is taking place, different objects (constraints, indexes, foreign keys, etc) are shown to be copied; their appears to be ordering of these items. Shouln't a dependancy tree be established, and object converted based on this?
4. Several tables, in my case about 250 tables did NOT get any data copied across. No reasons given.
5. A log of all activities should be produced for review and completeness.
6. I tried to use the "Migrate select tables" option but met with no success. Apparently, it makes an assumption that both the "source" and "target" databases wil be of the same type (ie both SQL Server or both Oracle); this does not make any sense to me since the point of the exercise is to migrate data from one database vendor to another. Obviously, different database vendors use differing datatypes for similar data (ie dates).
7. I noticed in the "Migration" sql that the "Connect" statements are not correct; they were missing the "instance name" portion.
8. Also, when I looked in the "MIGRATION" sql, I could not find any entries for the last step of the conversion - the movement of data from SQL Server to Oracle. Is this intentional or an oversight.
I dont want to appear negative on this Migration; I have used SQL Developer since it inception; in my opinion this is the best attempt to date.
Murray SobolHi Murray,
Thanks for this feedback.
There is a lot of questions here, I think some of it boils down to misunderstandings, which we should clarify in the doc.
Hopefully Ill get a video of a migration online soon as well.
But here is a brief break down.
*1.*
"The wizard asked me to specify the new Oracle database; instead it just ignored this information and created an Oracle database similarly named as the SQL Server database."
So this relates to Step 7 of the Migration Wizard. Where you can select the target connection.
SQL Developer doesn't ignore the Target Connection you selected, It just uses it to connect to the target database , not the target schema.
SQL Developer generates a new target schema for the migrated objects. It standard approach is not to generate objects directly into an existing Schema.
The Target Connection is used to create all the migrated objects (including new Oracle Schemas) in your target oracle database. So you should choose an Oracle Target Connection which has enough privileges to create new Schemas and Objects.
But as you have found, it doesn't generate the migrate objects , like tables, ... , directly into your chosen Target Connection.
From the errors you encountered it doesn't sound like the Target Connection (and the underling Oracle Schema) doesn't have the privileges to create other Schemas.
If you use something like a connection to the SYSTEM schema on your target database, it should run OK.
It wont create any objects in SYSTEM, rather it will use SYSTEM privileges to create a new schema (ex: dbo_Northwind) and populate it.
You don't have to use SYSTEM, but you do need a schema with enough privileges to create other schemas.
That is the straight forward way. But if you really need to generate into an existing schema the following steps can be taken.
a)rename the schema under the Converted Database Objects
b)Right click "Converted Databases Objects" and choose generate. it will kick off the Migration Wizard in the correct place
*2.*
My schema consists of 1000+ tables; approximately 10 tables were NOT created. When I copied the SQL from Migration.sql making NO changes and pasted it into the new Oracle database it created without issues.
When you say Migration.sql , is the entire generation file , which can be found in your <outputspecified>/generated/<projectname.modelname>.sql ?
When your say "pasted it into the new Oracle database" , are you running it in SQL Developers SQL Worksheet using the Target Connection.
Basically your migration is all out of shape once the target Schemas are not created. So the above issues (insufficient privileges) has to be resolved first.
Please post back if it is still an issue.
*3.*
While the conversion is taking place, different objects (constraints, indexes, foreign keys, etc) are shown to be copied; their appears to be ordering of these items. Shouln't a dependancy tree be established, and object converted based on this?
Objects are converted in a particular order and their dependencies are persisted so that they can be generated in the correct order.
Are you seeing an issue?
*4.*
Several tables, in my case about 250 tables did NOT get any data copied across. No reasons given.
I'm surprised any tables were populated with data due to the target schema not being created.
The online data move is pretty simple and it does not report or recover very well from issues.
If you are having difficulties once item 1. is resolved, please post an example of the source table and I will give it a go.
For better control of the data move with much more powerful tweaking, error handling, reporting and performance try the offline data move.
SQL Developer can created a suite of scripts which use SQL Servers BCP tool to dump out the data to dat files, and Oracle SQL*Loader tool to insert the data in the dat file into Oracle.
*5.*
A log of all activities should be produced for review and completeness.
The output/generated/<projectname.modelname>.out provides the output of running the generation script.
The migration reports http://dermotoneill.blogspot.com/2010/11/migration-reports-30.html outline what happens during the migration.
Apart from online data move issues, is there any other data missing?
*6.*
I tried to use the "Migrate select tables" option but met with no success. Apparently, it makes an assumption that both the "source" and "target" databases wil be of the same type (ie both SQL Server or both Oracle); this does not make any sense to me since the point of the exercise is to migrate data from one database vendor to another. Obviously, different database vendors use differing datatypes for similar data (ie dates).
Do you mean "Copy To Oracle" ? This option is intended to migrate tables from non Oracle databases like SQL Server to Oracle.
Can you give more details on what issue you are seeing.
*7.*
I noticed in the "Migration" sql that the "Connect" statements are not correct; they were missing the "instance name" portion.
The generation script is meant to be run using SQL Developers SQL Worksheet. I think you only get this "instance name" issue if running from SQL*Plus.
Can you confirm
8. Also, when I looked in the "MIGRATION" sql, I could not find any entries for the last step of the conversion - the movement of data from SQL Server to Oracle. Is this intentional or an oversight.
The online data move is performed separately from creating the objects. It is not script based, it uses JDBC to pump the data from the source database to the target database.
In summary , I would
a) Create a connection to your Target database using your SYSTEM schema
b) Right click on your "Converted Database Objects" and choose "Generate Target"
c) Choose your new "System" connection as the Target Connection
d) Follow the Migration Wizard to the end.
You will end up with a new target Schema and the migrated objects in it.
Check the .out file to see the errors
and the migration reports http://dermotoneill.blogspot.com/2010/11/migration-reports-30.html
Regards,
Dermot
SQL Developer Team. -
Write the DDL to construct the Facebook User and Post tables in SQL server.
Write the DDL to construct the Facebook User and Post tables in SQL server. You need to populate the user table with the user’s information provided as in Figure 1 and additional attributes may be needed for the design. Use the ID in the excel file to
identify the other Facebook user. For example ID 612831408762037 is David Cunliffe. Import the excel sheets to SQL server and then write effective SQL to merge the two tables into the Post table. Ensure the relationship is maintained between entities. Submit
the SQL scripts that create the database and tables, import the excel sheets and populate the tables such that one can re-create the database and tables with all the data by running the script.IF NOT EXISTS(SELECT * FROM sys.databases WHERE name = N'xxx')
CREATE DATABASE xxx
GO
USE xxx
IF EXISTS(SELECT * FROM sys.tables WHERE name = N'DAVID')
DROP TABLE DAVID;
IF EXISTS(SELECT * FROM sys.tables WHERE name = N'JOHN')
DROP TABLE JOHN;
IF EXISTS(SELECT * FROM sys.tables WHERE name = N'NEWDAVID')
DROP TABLE NEWDAVID;
IF EXISTS(SELECT * FROM sys.tables WHERE name = N'NEWJOHN')
DROP TABLE NEWJOHN;
IF EXISTS(SELECT * FROM sys.tables WHERE name = N'USER')
DROP TABLE [USER];
IF EXISTS(SELECT * FROM sys.tables WHERE name = N'POST')
DROP TABLE POST;
CREATE TABLE DAVID(
ID VARCHAR(100),
[MESSAGE] VARCHAR(MAX),
[TYPE] VARCHAR(MAX),
CREATED_TIME VARCHAR(MAX),
UPDATED_TIME VARCHAR(MAX),
SHARES_COUNT VARCHAR(MAX),
[COUNT OF LIKES NAME] VARCHAR(MAX),
[COUNT OF COMMENTS MESSAGE] VARCHAR(MAX),
LINK VARCHAR(MAX),
NAME VARCHAR(MAX),
[DESCRIPTION] VARCHAR(MAX),
CREATE TABLE JOHN(
ID VARCHAR(100),
LINK VARCHAR(MAX),
NAME VARCHAR(MAX),
[DESCRIPTION] VARCHAR(MAX),
[TYPE] VARCHAR(MAX),
CREATED_TIME VARCHAR(MAX),
UPDATED_TIME VARCHAR(MAX),
[COUNT OF LIKES NAME] VARCHAR(MAX),
[COUNT OF COMMENTS MESSAGE] VARCHAR(MAX),
[MESSAGE] VARCHAR(MAX),
SHARES_COUNT VARCHAR(MAX),
EXECUTE (N'BULK INSERT DAVID FROM ''' + 'datapath' + N'david.csv''
WITH (
CHECK_CONSTRAINTS,
CODEPAGE=''ACP'',
DATAFILETYPE = ''char'',
FIELDTERMINATOR= '','',
ROWTERMINATOR = ''\n'',
KEEPIDENTITY,
TABLOCK
EXECUTE (N'BULK INSERT JOHN FROM ''' + 'datapath' + N'john.csv''
WITH (
CHECK_CONSTRAINTS,
CODEPAGE=''ACP'',
DATAFILETYPE = ''char'',
FIELDTERMINATOR= '','',
ROWTERMINATOR = ''\n'',
KEEPIDENTITY,
TABLOCK
SELECT * FROM DAVID
SELECT * FROM JOHN
CREATE TABLE NEWDAVID(
POST_ID VARCHAR(100),
[USER_ID] VARCHAR(100),
CREATED_DATE VARCHAR(MAX),
CREATED_YEAR VARCHAR(MAX),
CREATED_MONTH VARCHAR(MAX),
UPDATED_DATE VARCHAR(MAX),
UPDATED_YAER VARCHAR(MAX),
UPDATED_MONTH VARCHAR(MAX),
[MESSAGE] VARCHAR(MAX),
SHARES_COUNT VARCHAR(MAX),
[COUNT OF LIKES NAME] VARCHAR(MAX),
[COUNT OF COMMENTS MESSAGE] VARCHAR(MAX),
NAME VARCHAR(MAX),
[TYPE] VARCHAR(MAX),
LINK VARCHAR(MAX),
[DESCRIPTION] VARCHAR(MAX),
CREATE TABLE NEWJOHN(
POST_ID VARCHAR(100),
[USER_ID] VARCHAR(100),
CREATED_DATE VARCHAR(MAX),
CREATED_YEAR VARCHAR(MAX),
CREATED_MONTH VARCHAR(MAX),
UPDATED_DATE VARCHAR(MAX),
UPDATED_YAER VARCHAR(MAX),
UPDATED_MONTH VARCHAR(MAX),
[MESSAGE] VARCHAR(MAX),
SHARES_COUNT VARCHAR(MAX),
[COUNT OF LIKES NAME] VARCHAR(MAX),
[COUNT OF COMMENTS MESSAGE] VARCHAR(MAX),
NAME VARCHAR(MAX),
[TYPE] VARCHAR(MAX),
LINK VARCHAR(MAX),
[DESCRIPTION] VARCHAR(MAX),
INSERT INTO NEWJOHN
SELECT SUBSTRING(ID, CHARINDEX('_', ID) + 1, LEN(ID) - CHARINDEX('_', ID)) AS POST_ID,
SUBSTRING(ID, 1, CHARINDEX('_', ID) -1) AS [USER_ID],
SUBSTRING(CREATED_TIME, 1, 10) AS CREATED_DATE,
SUBSTRING(CREATED_TIME, 1, 4) AS CREATED_YEAR,
SUBSTRING(CREATED_TIME, 6, 2) AS CREATED_MONTH,
SUBSTRING(UPDATED_TIME, 1, 10) AS UPDATED_DATE,
SUBSTRING(UPDATED_TIME, 1, 4) AS UPDATED_YEAR,
SUBSTRING(UPDATED_TIME, 6, 2) AS UPDATED_MONTH,
[MESSAGE], SHARES_COUNT, [COUNT OF LIKES NAME], [COUNT OF COMMENTS MESSAGE], NAME, [TYPE], LINK, [DESCRIPTION]
FROM JOHN
INSERT INTO NEWDAVID
SELECT SUBSTRING(ID, CHARINDEX('_', ID) + 1, LEN(ID) - CHARINDEX('_', ID)) AS POST_ID,
SUBSTRING(ID, 1, CHARINDEX('_', ID) -1) AS [USER_ID],
SUBSTRING(CREATED_TIME, 1, 10) AS CREATED_DATE,
SUBSTRING(CREATED_TIME, 1, 4) AS CREATED_YEAR,
SUBSTRING(CREATED_TIME, 6, 2) AS CREATED_MONTH,
SUBSTRING(UPDATED_TIME, 1, 10) AS UPDATED_DATE,
SUBSTRING(UPDATED_TIME, 1, 4) AS UPDATED_YEAR,
SUBSTRING(UPDATED_TIME, 6, 2) AS UPDATED_MONTH,
[MESSAGE], SHARES_COUNT, [COUNT OF LIKES NAME], [COUNT OF COMMENTS MESSAGE], NAME, [TYPE], LINK, [DESCRIPTION]
FROM DAVID
SELECT * FROM NEWDAVID
SELECT * FROM NEWJOHN
CREATE TABLE POST (
POST_ID VARCHAR(100) NOT NULL,
[USER_ID] VARCHAR(100),
CREATED_DATE VARCHAR(MAX),
CREATED_YEAR VARCHAR(MAX),
CREATED_MONTH VARCHAR(MAX),
UPDATED_DATE VARCHAR(MAX),
UPDATED_YAER VARCHAR(MAX),
UPDATED_MONTH VARCHAR(MAX),
[MESSAGE] VARCHAR(MAX),
SHARES_COUNT VARCHAR(MAX),
[COUNT OF LIKES NAME] VARCHAR(MAX),
[COUNT OF COMMENTS MESSAGE] VARCHAR(MAX),
NAME VARCHAR(MAX),
[TYPE] VARCHAR(MAX),
LINK VARCHAR(MAX),
[DESCRIPTION] VARCHAR(MAX),
INSERT INTO POST
SELECT * FROM NEWDAVID UNION SELECT * FROM NEWJOHN
SELECT * FROM POST
CREATE TABLE [USER]
[USER_ID] VARCHAR(100) NOT NULL,
INSERT INTO [USER] VALUES (612831408762037),(1119736203)
ALTER TABLE [USER] ADD PRIMARY KEY([USER_ID])
ALTER TABLE POST ADD PRIMARY KEY(POST_ID)
ALTER TABLE POST ADD FOREIGN KEY([USER_ID]) REFERENCES [USER]([USER_ID]) -
Quick Migrate: SQL Server database to Oracle
When I try Quick Migrate: SQL Server database to Oracle, I get the following error messages:
1. Locating source plugin...failed
2. Checking multi-schema privileges...Privilege 'CREATE ROLE" is not granted with admin option.
Error #1 I do not understand.
Error #2: I created the user as follows:
DROP USER GRAINTEST CASCADE
CREATE USER GRAINTEST
IDENTIFIED BY SQL
DEFAULT TABLESPACE SMARTSOFT_DATA
TEMPORARY TABLESPACE TEMP
QUOTA UNLIMITED ON SMARTSOFT_DATA
QUOTA UNLIMITED ON SMARTSOFT_INDEX
GRANT CONNECT,
RESOURCE,
CREATE ROLE,
CREATE VIEW,
CREATE SESSION,
ALTER ANY TRIGGER TO GRAINTEST
DROP ROLE R_GRAINTST
CREATE ROLE R_GRAINTST NOT IDENTIFIED
GRANT R_GRAINTST TO GRAINTEST
WITH ADMIN OPTION
Thanks
MurrayMurray,
Apologies for referring to the 1.5 documentation but the 2.1 documentation still has the same information about creating a user to hold the repository.
You initially reported 2 problems -
1. Locating source plugin...failed
2. Checking multi-schema privileges...Privilege 'CREATE ROLE" is not granted with admin option.
For the first error have you installed the necessary JDBC driver ? I have just installed SQL*Developer 2.1 on a new laptop and could successfully connect following the documentation steps -
Oracle® SQL Developer
User’s Guide
Release 2.1
2.5.2 Before Migrating From Microsoft SQL Server or Sybase Adaptive Server
To configure a Microsoft SQL Server or Sybase Adaptive Server database for
migration:
1. Ensure that the source database is accessible by the Microsoft SQL Server or
Sybase Adaptive Server user that is used by SQL Developer for the source
connection. This user must be able to see any objects to be captured in the
Microsoft SQL Server or Sybase Adaptive Server database; objects that the user
cannot see are not captured. For example, if the user can execute a stored
procedure but does not have sufficient privileges to see the source code, the stored
procedure cannot be captured.
2. Ensure that you can connect to the Microsoft SQL Server or Sybase Adaptive
Server database from the system where you have installed SQL Developer.
3. Ensure that you have downloaded the JTDS JDBC driver from
http://jtds.sourceforge.net/.
4. In SQL Developer, if you have not already installed the JTDS driver using Check
for Updates (on the Help menu), do the following:
a. Click Tools, then Preferences, then Database, then Third Party JDBC Drivers.
b. Click Add Entry.
c. Select the jar file for the JTDS driver you downloaded from
http://jtds.sourceforge.net/.
d. Click OK.
========
The second error is again documented in the 2.1 documentation -
5.99 Privilege Warning for Migration
This dialog box is displayed if you click Verify in the Quick Migrate box and the
database user for the connection does not have all privileges necessary for a
multischema migration. For multischema migrations, this user must granted the
RESOURCE role with the ADMIN option; and this user must also be granted the
CREATE ROLE, CREATE USER, and ALTER ANY TRIGGER privileges, all with the
ADMIN option.
If you are performing a single-schema migration, you can ignore this warning.
=====
Which errors are you now seeing and which user was used to hold the repository ?
If you are using GRAINTEST for the repository then create it using this syntax -
CREATE USER GRAINTEST IDENTIFIED BY password <=== change password as necessary
DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp; <=== change tablespaces as necessary
GRANT CONNECT, RESOURCE, CREATE VIEW, CREATE PUBLIC SYNONYM TO
GRAINTEST WITH ADMIN OPTION;
GRANT ALTER ANY ROLE, ALTER ANY SEQUENCE, ALTER ANY TABLE, ALTER TABLESPACE,
ALTER ANY TRIGGER, COMMENT ANY TABLE, CREATE ANY SEQUENCE, CREATE ANY TABLE,
CREATE ANY TRIGGER, CREATE ROLE, CREATE TABLESPACE, CREATE USER, DROP ANY
SEQUENCE, DROP ANY TABLE, DROP ANY TRIGGER, DROP TABLESPACE, DROP USER, DROP ANY
ROLE, GRANT ANY ROLE, INSERT ANY TABLE, SELECT ANY TABLE, UPDATE ANY TABLE TO
GRAINTEST with admin option ;
then when making the migration make sure the Oracle connection is to this user.
Please update the thread with the errors you get after following these steps.
Regards,
Mike -
About cluster table in sql server or SAP
Hello Gurus,
we have a cluster table "KONV" in our sql server 2008 , is that feature for cluster table native feature in sql server or in sap?
because some professonal said there is no concept for cluster table in sql server just like oracle database. so please help me for
clarification.
Many thanks,I agree, this is ABAP Dictionary specific way of data encapulation, not the DB type dependant one. Basically it stores the data in RAW or LRAW format.
Also be aware that we distinguish b/w [data clusters|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm] and [cluster tables|http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f083446011d189700000e8322d00/content.htm].
Regards
Marcin -
People Tools Table in SQL SERVER
Hi,
As we have PSDBOWNER table in Oracle or DB2 which helps us to change DB name after production refresh.
Like wise, i want to know list of People Tools Table in SQL SERVER which needs to change DB name from PRD TO TEST after refresh.
Rgds
PS AdminPeopleTools table will have the same name independent of Database you use.
PSDBOWNER table is the only table created on PS oracle database user. (This table will not present in the SYSADM schema.)
Thanks
Soundappan
Edited by: Soundappan on Jan 5, 2012 5:12 PM -
How can I get the data array from SQL Server Database?
Hi,
I can write a data array(2D)into a table of my SQL Server Database. The data array was writen to a column with image type. I know a data array is transformed a binary string when writing into database, but I dont know how to get the data array when I fetch the binary string from database.
My question is:
How to transform the binary string into data array? which vi's should I use? I have tried unflatten from string but failed.
Any response is appriciated.
Redhappyxh0518 wrote:
> I can write a data array(2D)into a table of my SQL Server Database.
> The data array was writen to a column with image type. I know a data
> array is transformed a binary string when writing into database, but I
> dont know how to get the data array when I fetch the binary string
> from database.
>
> My question is:
> How to transform the binary string into data array? which vi's should
> I use? I have tried unflatten from string but failed.
In order to use Unflatten from string you first need to Flatten it
before writing it. Also depending on the database driver, the returned
data may actually not be binary but Hexadecimal encoded ASCII which you
would first have to decode to binray.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
How to Create a Temporary Table with SQL Server
I know you can create a temporary table in SQL Server 2000, but not quite sure how to do it in CFMX 7, i.e., does the SQL go inside a <CFQUERY dbtype="query"> tag?
I'm pulling the main set of records from an Oracle server (1st data source), but it does not contain employee names, only employee IDs. Since I need to show the employee name along with the Emp ID, I'm then pulling a list of "current" employee names from a SQL Server (2nd data source), which is the main database on our CF server.
I've got a QofQ that works fine, except it only matches EmpIDs that exist in both result sets. Employees who are no longer employed, don't match, and don't display. Since I can't do a LEFT OUTER JOIN with a QofQ, what I need to do is get the records from the Oracle server into the SQL Server. Preferably in a temporary table.
I was hoping if I could get those Oracle records written to a temp table on the main SQL Server, in same database as the Employee Name table, I could then write a normal <CFQUERY> that uses a LEFT OUTER JOIN.
I think I could probably write a Stored Procedure that would execute the SQL to create the temporary table, but am trying to avoid having to write the SP, and do it the simplest way.
This query will be a program that can be run hundreds of times per day, with a form that allows users to select date ranges, locations, and other options. That starts the queries, which creates the report. So I just need the temp table to exist only until all the SQL has run, and the <CFOUTPUT> has generated a report.
If the premise is right, I just need some help with the syntax for creating a SQL Server temp table, when you want to write records to it from an external data source. I'm trying the following, but getting an error:
<CFQUERY name="ITE_Temp" datasource="SkynetSQL">
CREATE TABLE #MyTemp
( INSERT INTO #MyTemp
ITE2.TrueFile char (7) NOT NULL,
ITE2.CountOfEmployee int NULL,
ITE2.DTL_SUBTOT decimal NULL,
ITE2.EMPTYPE char (3) NULL,
ITE2.ARPT_CD char (3) NULL
</CFQUERY>
So I actually created a permanent table on the SQL Server, and wrote the below SQL, which does work, and does write the records to table. I can then write another CFQUERY with a LEFT OUTER JOIN, and get all the records, including those that don't have matching employee name:
<CFQUERY datasource="SkynetSQL">
<CFLOOP index="i" from="1" to = "#ITE2.RecordCount#">
INSERT INTO ITE_Temp
(FullFile,
EmployeeCount,
DTL_Amount,
EmployeeType,
station)
VALUES ('#ITE2.TrueFile[i]#',
#ITE2.CountOfEmployee[i]#,
#ITE2.DTL_SUBTOT[i]#,
'#ITE2.EMPTYPE[i]#',
'#ITE2.ARPT_CD[i]#')
</CFLOOP>
</CFQUERY>
But, I hate to have to create a table and physically write to it. For one, it seems slower, and doing it in temp would be in memory, and probably much faster, correct? Is there some way to code the above, so that it does something similar, but in a TEMPORARY TABLE? If I can figure out how to do this, I can pull data from multiple data sources and servers, and using SQL Server temp tables, work with the data as if it was all on the same SQL Server, and do some cool reports.
Everything I've done for the past few years, has all been from data from a single source, whether SQL Server, or another server. Now I need to start writing reports where data can come from 3 or 4 different servers, and be able to do joins (inner and outer). Thanks for any advice/help. Much appreciated.
GaryWhile waiting to hear back, I was able to write the query results from an outside Oracle server, to a table on the local SQL Server, and do the LEFT OUTER JOIN required for the final query and report to work. That was with this syntax:
<CFQUERY name="AddTableRecords" datasource="MyTable">
TRUNCATE TABLE ITE_Temp
<CFOUTPUT query="ITE2">
INSERT INTO ITE_Temp
(FullFile,EmployeeCount,DTL_Amount,EmployeeType,station)
VALUES
('#TrueFile#', #CountOfEmployee#, #DTL_SUBTOT#, '#EMPTYPE#', '#ARPT_CD#')
</CFOUTPUT>
</CFQUERY>
However, I was not able to write to a temporary table AND read the results. I got the syntax to run to write the above results to a temporary table. But when I tried to read and output the results from the temp table, I got an error. Also, it wouldn't take the single "#" (local) only the global "##" table var, using this syntax. Note that if I didn't have the DROP TABLE in the beginning, the 2nd time you run this query, you get an error telling you the table already exists.
<CFQUERY name="ITE_Temp2" datasource="MyTable">
DROP TABLE ##MyTemp2
CREATE TABLE ##MyTemp2
FullFile char (7) NOT NULL,
EmployeeCount int NULL,
DTL_Amount decimal NULL,
EmployeeType char (3) NULL,
station char (3) NULL
<CFOUTPUT query="ITE2">
INSERT INTO ##MyTemp2 VALUES
'#ITE2.TrueFile#',
#ITE2.CountOfEmployee#,
#ITE2.DTL_SUBTOT#,
'#ITE2.EMPTYPE#',
'#ITE2.ARPT_CD#'
</CFOUTPUT>
</CFQUERY>
So even though the above works, I could use some help in reading/writing the output. I've tried several things similar to below, but they don't work. It't telling me ITE_Temp2 does not exist. It's not easy to find good examples of creating temporary tables in SQL Server.
<CFQUERY name="QueryTest2" datasource="SkynetSQL">
SELECT *
FROM ITE_Temp2
</CFQUERY>
<CFOUTPUT query="ITE_Temp2">
Output from Temp Table<br>
<p>FullFile: #FullFile#, EmployeeCount: #EmployeeCount#</p>
</CFOUTPUT>
Thanks for any help/advice.
Gary.
Maybe you are looking for
-
Hi, I am having a query in Asset Down Payment for AUC I have configured for both Acquisition: down payments and Down-payments clearing account in 'AO90' in asset module. But I am still not clear why Down-payments clearing account account needs to be
-
Default value of prompt based on another request
Hello: I have a requirement where I need to set default values of prompts based on another request. The prompt is a Date Prompt. I tried it using presentation variable, and writing sql query, where is says " WHERE promo_id= @{variable}" but it is sti
-
Safari is not playing video clips, ie the information tours, is there anything I can do? Help would be appreciated.
-
I have 4 completely different PCs running Windows 7 64 bit. Every time I manually clear the history/cookies/etc.. firefox locks up and crashes. This has been happening since firefox 4 and still exists in firefox 5. Also, closing firefox (4 or 5) does
-
Please provide specifics on setting PSE12 editor as an EXTERNAL editor for iPhoto
I need specifics, please...brand new to PSE12