PowerBI - Execute MO_GLOBAL.SET_POLICY_CONTEXT() on Connect - sql

I connecting to an Oracle database with an read only account through PowerBI. I am looking to run a query on tables/views that the account may not have the correct view privileges. I can run the query under the same account by using the statement below in Oracle SQL Developer.
begin
MO_GLOBAL.SET_POLICY_CONTEXT('S', #MY NUMBER HERE#);
end;
Is there a way to do this in PowerBI, or in the ODBC Oracle Driver setup, so it executes on connect or in line with my SQL statement that I am running to get my data?

Related

SSIS Automation

I came across a good SSIS and SQL Problem. How do I in SSIS create a package that will execute a SQL query in management studio and grab the results of that query (the query results are "Insert INTO statements") and run that insert into statement query results into another sql database within SSIS that updates a table in another server? (The first query runs in one database and the second query runs in a different database)
First of all, sql queries execute on the database, not management studio. Management studio is visual interface for configuring,managing and administer databases.
To me it doesn't sound like there's any problem here at all. Create one connection manager for each DB. Then create two "Execute SQL Tasks", put your insert statements in them use use your connection manangers you've created.
Run the first query in an Execute SQL task and store the results in a string variable.
Then run a second Execute SQL task, using the variable as your SQL command.
Create Connection Managers for each of the databases you need, your source and both (or all) destinations.
Create a Data Flow Task.
In your OLEDB Source, execute your SELECT statement.
Pump the results into a MultiCast Transformation. This allows you to send the exact same result set to multiple destinations.
Create a Destination for each table you want to write to, and connect them to the MultiCast.
Bob's your uncle.

Get data from Oracle to SQL server after Oracle statements is excuted

I'm making a project with SQL Server but I just can get data from Oracle database in my customer's PC. Because they want to manage data before i can do with it. I have used Linked Server of Microsoft and Microsoft SQL Server Migration Assistant for Oracle to get data from Oracle database. But I have a problem I dont know when my customer INSERT, DELETE, UPDATE Oracle records. Is there anyway to migrate data from Oracle automatically to my SQL Server?
Really need a help. I have to manual do it everytime I want to update SQL Server database to get new records from Oracle.
Thanks in advance!

Connect SQL Server to SAP Backend (also a SQL Server)

I am trying to connect my SQL Server directly to the SAP backend database so that I don't have to extract the data everyday (for fresh data) using SSIS packages.
Instead I want to create views that will access this data directly (direct querying) and get refreshed periodically.
Can someone give me a link or show/tell me the steps on how to do this?
If you know the hostname of the backend server, you can do something like this:
SELECT TOP 1 * FROM hostname.databasename.dbo.tablename
If you want to access your data from external SQL server directly in SAP you can define connection to external database in transaction DBCO:
Then in your ABAP code you can write SQL statements using OPEN SQL:
EXEC SQL.
CONNECT TO my_new_connection.
ENDEXEC.
...
EXEC SQL.
SELECT * INTO TABLE :lt_internal_table FROM dbtable.
ENDEXEC.
...
EXEC SQL.
DISCONNECT my_new_connection.
ENDEXEC.
or using Classes CL_SQL_CONNECTION, CL_SQL_STATEMENT. An Example program ADBC_DEMO show how to use it.

Dump ERP queries in informix

We have a closed source application here, that connect to an informix database ( using odbc )
is there any way I can see the queries being executed by this application?
Turn on ODBC tracing. Some information can be found here.
Multiple possibilities :
those give all the statements
like mentioned above odbc tracing.
set explain on as pre sql (generates huge files with the sqls and query plans).
those the current running statements.
using onstat commands on the server running the database (onstat -g sql ).
connecting to the monitoring database (sysmonitor) and querying the session tables .

Run SQL script on multiple DB connections at same time in Oracle SQL Developer

I have 4 different database connections in Oracle SQL Developer. All of them have the exact same set of packages and procedures. Every time I change something in my scripts I have to run it on all of the connections one-by-one. Is there no way to run it on all the connections at the same time?
I'm afraid that you can only execute SQL developer queries on different connections using the GUI.
You should, however, be able to acheive what you want using SQLPlus instead.
You can use "create database link" function:
CREATE DATABASE LINK linkDB_1
CONNECT TO xxxx IDENTIFIED BY xxxx
USING 'xxxxx';
SELECT *
FROM tablename#linkDB_1;
DROP DATABASE LINK linkdb_1;
I tested on my SQL Navigator, and it works.