how can import "export user object" in pl/sql? - oracle

Step 1:
I went to the tools menu in origin oracle pl sql then choose export user object and select that file i need to convert to destination database like view and functions and packages etc...
Step 2 :
after that i went to destination database and open new command window and paste that file create in step1.
after that i get this error for many objects:
ora00900 : invalid sql statement
how can i import that file created with pl/sql export user object?

If you are using Oracle SQL Developer and trying to export DDL and Data, make sure that selected format is "insert". Other formats are not applicable to run as SQL statement.
If your goal is full export consider using Oracle DataPump: https://docs.oracle.com/en/database/oracle/oracle-database/19/sutil/oracle-data-pump-overview.html

Related

How can you create a view as a post deployment script in a SQL Server Database Project?

I've create a SQL Server Database Project and imported my database. I've got a few static data tables that I want to recreate every time it's redeployed, so these get recreated as part of the post deployment script.
To ensure this drops and recreates them I've changed these static data tables to have a build action of 'None' so they are dropped as part of the build and only recreated as part of post deployment steps.
My problem is that I have a view that references these tables. Obviously this shows syntax errors as the tables are no longer part of the build as their build action is 'None'. My workaround was to try and create the view also as part of the post deployment script. I do this with the following code:
:r .\PostDeploymentScripts\Views\myView.sql
The actual script looks like this:
CREATE VIEW [CompTotalByType] AS
SELECT
c.Id,
t.id AS TypeId,
SUM(c.total) AS CompTotal,
FROM CompNumber c
INNER JOIN Type t
ON t.ProdId = c.ProdId
GROUP BY
c.Id,
t.id
However, now I get a syntax error under 'CREATE VIEW' as follows:
Severity Code Description Project File Line Suppression State
Error SQL72007: The syntax check failed 'Incorrect syntax near CREATE.' in the batch near:
'CREATE VIEW [CompTotalByType] AS' ....path name....
However, when I put this code into SSMS it has no syntax errors. What's causing this?
I found the answer here: SQL72007: The syntax check failed 'Unexpected end of file occurred.' in batch near :
It was the second answer that said you needed to add a 'GO' to the previous script. This makes sense as the CREATE VIEW needs to be in its own batch. So I added a 'GO' to the bottom of my previous script before creating the view and that fixed it.
How many static tables are you trying to recreate? I have a similar situation, but what I do instead is create 'MERGE' scripts using a stored procedure on Github called sp_generate_merge. Then I simply include those scripts within the project under a 'Scripts' folder and call them within the post-deployment script. That way you don't have to drop/create them, and your view and tables can be included in the build.
However, if you'd like to keep it the same - it seems that the other user is correct in saying that you need to add 'GO' before 'CREATE VIEW'.

Microsoft office cannot find the input table or query

I am trying to migrate an access database from 2000 to 20007 version. I have two .mdb files one used as a front end and the other containing only the back end tables. I performed all the necessary initialization for the migration like export of table, extension with .accd, etc.. But when i execute the following code , i get an error " Microsoft office cannot find the input table or query . Check spelling and so".
set Db=currentDb
SQLText ='some sql query'
Db.OpenRecordset(SQLText, dbOpenDynaset)
When i tried to output the value of Db with a msgbox (MSgbox Db), it shows the message "ABC, type mismatch", where ABC is the function name. But, Msgbox Db.name showing the correct database name. But, the same code has been running fine on the older version.
Please help me on this
Okay, you do not have to "migrate" to a different version persay. You only have to import everything from an MDB to ACCDB file. That is all. Scratch whatever you have done, start afresh.
Create a new "empty" accdb file, then using the options under
External Data-> Import/Link From Access. Select the Front End Access
file. Use the Option IMPORT Forms, Report etc., select all Forms, Reports, Queries, Mods then click OK. This
will import all objects.
Create a new "empty" accdb file, then using the options under
External Data-> Import/Link From Access. Select the Back End Access file. Use the Option IMPORT Forms, Report etc., select all tables and click OK. This will import all the tables over to the new file.
Now open up your new "front end" (the one with accdb extension). Under External Data -> Import/Link. Select the new "back end" (the one with the accdb extension). Use the Link to the Data Source option. Then select all tables and click OK.
Now perform a Compact & Repair, follow it with a Compile of the VBA code.
The whole strategy will fail if you have a backend DB in a different platform like SQL or Oracle.

SQL Developer How to export store procedures into separate files?

I am using Oracle SQL Developer 3.2 and I have about 100 stored procedures/functions that I'd like to export them into separate individual files. Here's what I'd like to achieve:
Each file name should be the same as the stored procedure/function name.
The file content is just the content of the stored procedure/function, as if I open the stored procedure, copy and paste into a text file and save.
Any one knows how to do it? Thanks.
As a1ex07 stated in his comment. You can achieve that. Go Tools -> Database Export -> Select the file where you want to create stored procedure/function and select the connection name -> Types to Export -> Specify Object -> Specify Data -> Finish

oracle export and import only user and their roles

I have two question about oracle export and import.
First of all,I want to export only user and their roles not tables,trigger and other object Later import user
How i can do?
Other question is while importing operation, can i get error?Because, which object importing early roles or user? Unless importing roles, user can't assign roles?
You must be using ddl statements, look How to clone user in Oracle and https://dba.stackexchange.com/questions/30337/duplicate-an-oracle-database-user ,and if you are using SQL Navigator, you can select user in the tree (press F12) and press Ctrl+D

Magento catalog_eav_attribute foreign key fails phpmyadmin

I am trying to do a simple copy of my database using phpmyadmin and I am getting an error seen at this link http://screencast.com/t/WB9WGs6mW
I have tried to dump the database with the disable foreign key option but I still get the same error after importing the database and trying to copy.
I am running magento 1.8.1.0 community just did an update recently from magento 1.8.0.0
If you are creating the dump with phpMyAdmin, I suggest you to select "Custom" as export method and tick the "Add drop table" statement in the Object creation options.
Otherwise, If you have access to the shell, you can create a dump with the --opt parameter.
mysqldump -uuser -p --opt dbname > dumpfile.sql
Be sure you follow this instructions in phpmyadmin export:
Export Method: custom
Format specific options: tick Disable foreign keys check
in Object creation options: tick Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement
in Data creation options: tick Truncate table before insert
Let me know if it works.

Resources