I'm trying to export a schema in an oracle 10 database using the EXP command. Let's call the schema "myschema" and the tns name "mydb" to protect the names of the innocent. Anyway, here's the command line that I'm using
exp myschema/mypassword#mydb file=myschema.dmp grants=y
This works when I try to run an export on other instances, but I get the following error when I try against "mydb".
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses UTF8 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user MYSCHEMA
. exporting PUBLIC type synonyms
EXP-00008: ORACLE error 980 encountered
ORA-00980: synonym translation is no longer valid
EXP-00000: Export terminated unsuccessfully
Anybody have any ideas? If any further info is needed let me know and I'll edit this question accordingly.
This can happen if the JVM installation is corrupted. Try:
SELECT comp_id, schema, status, version, comp_name
FROM dba_registry
ORDER BY 1;
If this returns a row with the comp_id of JAVAVM with a status of 'INVALID' you'll need to reinstall the java VM.
Metalink document 276554.1 has the procedure for doing so. If you can recover easily, it might be easier to recreate the database and reload it.
EDIT: I found Oracle-base link where a poster claims this will uninstall and reinstall the JVM (on Unix), I presume it works on windows with slight mods:
(WARNING! You can seriously hose your database if things go wrong here. BACKUP first!)
cd $ORACLE_HOME/javavm/install
sqlplus / as sysdba
#rmjvm.sql
#initjvm.sql
-- Recompile invalid objects
#?/rdbms/admin/utlrp
The metalink note is quite a bit more involved.
Related
I have a very strange 'reload.sql' file that I need to use to build a database.
It references about 200 XXX.dat files with straight-up readable data (although useless without explanations regarding the meaning of the fields).
I have tried msssql server, mysql workbench (on a server local-hosted on wamp), and directly accessing it through DBeaver and IBConsole, but I cannot manage to execute/build it.
It uses a weird syntax. There are elements like
begin
...
end
go
that hinted me towards T-SQL, but using sqlcmd on it gave me thousands upon thousands of errors regarding keywords.
Specifically, the very first batch of executable lines says
SET OPTION date_order = 'YMD'
go
SET OPTION PUBLIC.preserve_source_format = 'OFF'
go
SET TEMPORARY OPTION tsql_outer_joins = 'ON'
go
SET TEMPORARY OPTION st_geometry_describe_type = 'binary'
go
SET TEMPORARY OPTION st_geometry_on_invalid = 'Ignore'
go
SET TEMPORARY OPTION non_keywords = 'attach,compressed,detach,kerberos,nchar,nvarchar,refresh,varbit'
go
which generates about 150 errors 'Incorrect syntax near OPTION keyword' on its own, and according to google is part of a 'rexx' procedure but 'date_order' should then be 'DATFMT', right?
Another track is that of SyBase, but I cannot for the life of me get it to work (through my trials I did manage to build a .db file, that, well, is useless to me since I can't build it either..).
I've tried accessing it through ODBC pilots as well but none worked (the paradox ODBC did not crash, but said there was an error with a FROM clause, which are generated automatically...).
I need to know a way to build a database from this file or directly access the data it references, which I can't really post since it contains private medical data.
Also what madman came up with this.
The very first google link (for me anyway) against 'st-geometry-describe-option' shows this is a SAP SQL Anywhere database i.e. http://dcx.sybase.com/1200/en/dbadmin/st-geometry-describe-option.html
So I would suggest starting from the SQL Anywhere documentation and you will need to install the database software beforehand.
i'm trying to export a table with Oracle Datapump, running on a Oracle 12C Instance. The schema has a table called KAT.
When i do the export with:
expdp USER/PASS directory=exp dumpfile=dump.dmp logfile=kat.log TABLES=KAT
everything works as expected.
When i try to do the following (to be able to import the data in a Oracle 10g database), i get the following error:
expdp USER/PASS directory=exp dumpfile=dump.dmp logfile=kat.log TABLES=KAT VERSION=10.2
ORA-39166: Object USER.KAT was not found.
ORA-31655: no data or metadata objects selected for job
Why? Any ideas?
Most likely issue is that your table is using features that exist in 12c but not in 10.2. I'm getting the exact same error message trying to export a table with a virtual column (which were introduced in 11.1) from a 12c database:
No VERSION (i.e. COMPATIBLE): works
VERSION=11.2 or 11.1: works
VERSION=10.2: ORA-39166 error.
Could be a feature on the table itself, or one of its indexes (or constraints). Check the table's DDL.
I am trying to use the command, SET SCHEMA. However, it does not appear to be working, I get an error message. I am able to use the schema if I use Schema.Tablename, but this can be tedious. I am perfectly connected to the database and all the schema properties appear in my schemas folder.
The error message is below:
------------------------------ Commands Entered ------------------------------
SET SCHEMA RSBALANCE;
------------------------------------------------------------------------------
SET SCHEMA RSBALANCE
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0805N Package "NULLID.SQLC2H20 0X41414141415A425A" was not found.
SQLSTATE=51002
SQL0805N Package "NULLID.SQLC2H20 0X41414141415A425A
The syntax for DB2 is (Info Center link):
SET SCHEMA = 'YOUR_SCHEMA'
If you're using the Command Line Processor (which it appears you are by the error message), you have to use double-quotes (it does matter!):
SET SCHEMA = "YOUR_SCHEMA"
Information Center has documentation on the SQL0805N error.
This is the relevant course of action:
If the DB2 utility programs need to be rebound to the database, the
database administrator can accomplish this by issuing one of the
following CLP command from the bnd subdirectory of the instance, while
connected to the database:
For the DB2 utilities:
db2 bind #db2ubind.lst blocking all grant public
For CLI::
db2 bind #db2cli.lst blocking all grant public
Turns out that my machine was missing an update from IBM. This allowed me to use the command from bhamby to work properly.
Thank you all for your input.
I would like to run some ad hoc select statements in the IBM System I Navigator tool for DB2 using a variable that I declare.
For example, in the SQL Server world I would easily do this in the SQL Server Management Studio query window like so:
DECLARE #VariableName varchar(50);
SET #VariableName = 'blah blah';
select * from TableName where Column = #VariableName;
How can I do something similar in the IBM System I Navigator tool?
I ran across this post while searching for the same question. My coworker provided the answer. It is indeed possible to declare variables in an ad hoc SQL statement in Navigator. This is how it is done:
CREATE OR REPLACE VARIABLE variableName VARCHAR(50);
SET variableName = 'blah';
SELECT * FROM table WHERE column = variableName;
DROP VARIABLE variableName;
If you don't drop the variable name it will hang around until who knows when...
At the moment, we're working on the same issue at work. Unfortunaly, we concluded that this is not possible. I agree, it would be great but it just doesn't work that way. iNavigator doesn't support SET or Define. You can do that in embedded SQL but this is not embedded SQL. Even if you create a separate document (xxx.sql), then need to open this document to run the script what makes it an interactive script (that is, DECLARE SECTION is not allowed).
As an alternative, in the SQL screen/script you can use CL:. Anything after this prefix is executed as CL command. You may manipulate your tables (e.g. RNMF) this way.
As a second alternative, the iSeries does support Rexx scripts (default installed with the os). Rexx is good dynamic script language and it does support embedded SQL. I've done that a lot of times and it works great. I even created scripts for our production environment.
Just create one 'default' script with an example PREPARE and CURSOR statement and copy at will. With that script you can play around. See the Rexx manual for the correct syntax of exec-sql. Also, you do have STDIN and STDOUT but you can use 'OVRDBF' to point to a database table (physical file). Just let me know if you need an example Rexx script.
Notice that the manual "SQL embedded programming" does have Rexx examples.
Here are a couple of other alternatives.
Data Transfer Tool - You can run the iSeries Data Transfer Tool from the command line (RTOPCB). First, run the GUI version and create a definition file. If you edit this file with a text editor, you will see that this is just an old-fashioned INI file and you can easily find the line with the query in it. From there, you could write a batch file or otherwise pre-process the text file to allow you to manipulate the query before submitting it to the query tool.
QSHELL - If you can log on to the iSeries interactively, then you may find the QSHELL environment more familiar than CL or REXX (although REXX is kind of fun). QSHELL is a full POSIX environment running on the iSeries. Use the command STRQSH to start QSHELL. You can have ksh or csh as a shell. Inside QSHELL, there is a command called "db2" that submits queries. So, you should be able to do something like this inside QSHELL:
system> VariableName = 'blah blah'
system> db2 "select * from TableName where Column = \'$VariableName\'"
You may have to fiddle with the quotes to get ksh to pass them correctly.
Also, inside QSHELL, you should have a full Perl installation that will allow you to use DBI to get data.
Some other ways to interact with data on the iSeries: query from the client with Python via ODBC; query from the client with Jython via JDBC; install Jython directly on the iSeries and then query via JDBC.
I usually use SQLDeveloper to browse the database, but I couldn't make it work with HSQLDB and I don't know which tables are already created…
I guess it's a vendor-specific question and not plain SQL, but the point is: how can I see the tables so I can drop/alter them?
The ANSI SQL92 standard for querying database metadata is contained within the INFORMATION_SCHEMA data structures.
I have no idea whether your database supports this or not, but try the following:
SELECT *
FROM INFORMATION_SCHEMA.TABLES
On further research, it appears that HSQLDB does support INFORMATION_SCHEMA, but with slightly non-standard naming.
All of the tables have SYSTEM_* prepended to them, so the above example would read
SELECT *
FROM INFORMATION_SCHEMA.SYSTEM_TABLES
I have no means of testing this, and the answer was found on sourceforge.
Awesome, thanks! Been scouring the Web for that info.
This will fetch only your tables' field info:
SELECT TABLE_NAME, COLUMN_NAME, TYPE_NAME, COLUMN_SIZE, DECIMAL_DIGITS, IS_NULLABLE FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS WHERE TABLE_NAME NOT LIKE 'SYSTEM_%'
You can retrieve indexes, primary key info, all kinds of stuff from INFORMATION_SCHEMA.SYSTEM_TABLES.
Gotta love oo documentation :p
If you're on the command line, you may want to try the Hsqldb SqlTool, documented in the SqlTool Manual (hsqldb.org).
Put your database connection information in "~/sqltool.rc" and choose any DBNAME you want, substitute correct username and password, if known.
urlid DBNAME
url jdbc:hsqldb:/path/to/hsql/database
username SA
password
Install tool with: apt-get install hsqldb-utils (on Ubuntu)
Connect with hsqldb-sqltool DBNAME # on Ubuntu
Hint for other systems: java -jar YourHsqlJar.jar DBNAME
Show tables with: \dt
Show columns with: \d TABLENAME
Standard queries like: SELECT * FROM …;
Edit (append) last command with: :a
Quit with: \q
View special commands with: \? OR :?
Good luck!
Use the \dt command when you hit the >sql prompt in the command line for HSQLDB.
Check out DBVisualiser and SQuirreL SQL Client. Both of these have support for HSQLDB, and a GUI for editing/modifying/viewing the tables.
You run querying using hsql database manager, are you?
If you use this, below may give some hints:
Select your connection:
type: HSQL DATABASE ENGINE SERVER
Driver: jdbc.hsqldb.jdbcDriver
URL: jdbc:hsqldb:hsql://localhost/
Then, you will browse the database.