Tag Archives: oracle

Cause: java.sql.SQLException: invalid column type: 1111 Error [How to Fix]

Warming: Servlet.service() for servlet [spring] in context with path [/*****] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='ENTERPRISE_NAME', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #13 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: 1111] with root cause
java.sql.SQLException: Invalid column type: 1111
	at oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3978)

Screen:

When inserting the name,ENTERPRISE_NAME passes null and mybatis returns an error.
The solution is:

Oracle error collection solution

1.: ORA-00054: Resource is busy, but NOWAIT is specified to retrieve resource
The transaction is not committed because the table is locked
 
ORA-00959 tablespace does not have Oracle IMP import problem
If the table contains fields of type LOB, an ORA-00959 error will occur during the import, resulting in IMP-00017 and IMP-00003 errors, which will make the table import unsuccessful.
When importing, tables are created in the default tablespace of the importing user. However, physical storage parameters for LOB fields are specified separately and are not automatically created into the default tablespace.
The solution to the problem:
Create a tablespace with the same name in the import database beforehand to avoid this error
2. Since there are very few tables with LOB fields, I will now remove the storage parameter part of the creation script after import and re-execute it. If you have data, use the import and export tools in SQL/DEV
 
User =”sys”; user=”sys”; user=”sys”;
Java.sql. SQLExeption: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
Solution:
Set user name to “sys as sysdba”, other things remain the same, such as:
 
Protected final String url = “JDBC :oracle:thin: @host name: port number :SID”;
Protected final String user = “sys as sysdba”, password = “password “;
static {
try {
Class.forName(“oracle.jdbc.driver.OracleDriver”).newInstance();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
public Connection conn = DriverManager.getConnection(url, user, password);
 
Connection to the database no error, done.
 
ORA-12169: TNS: NET service name specified as connection identifier is too long
12169. 00000 – “TNS:Net service name given as connect identifier is too long”
*Cause: The net service name you are attempting to resolve is too long.
*Action: The maximum length of a net service name is 255 bytes; this limit
has been exceeded. Use a smaller net service name. If this
is not possible, contact Worldwide Customer Support.
 
 
Exceptionally long space caused by creating a dblink
 
 
5.drop database link ’20_TEST’
Error reporting –
SQL error: ORA-01729: Need database link name
01729. 00000 – “database link name expected”
*Cause:
*Action:
 
Drop database link “20_TEST”
 
 
SQL error: ORA-02018: Database link with the same name has an open connection
02018. 00000 – “database link of same name has an open connection”
Close the dblink:
Sql code
ALTER SESSION CLOSE DATABASE LINK [name];
Error:
ORA-02080: database link is in use
V $dblink view
Sql code
SELECT * FROM v$dblink;
The dblink is indeed not in transaction. Confused. ALTER SESSION (ALTER SESSION, ALTER SESSION, ALTER SESSION, ALTER SESSION)
ORA-02080: database link is not open
I know it should be possible to delete it and DROP it again.
 
 
ORA-01830: The date format image ends before converting the entire input string
 
The to_date(‘2012-11-11′,’ yyyy-mm-dd ‘) string format should be consistent with the conversion format
 
ORA-01810: Format code appears twice
01810. 00000 – “format code appears twice”
*Cause:
*Action:
select * from ly_sbqb_czrz where czsj > To_date (‘2018-04-22 23:59:59′,’ yyyy-mm-dd HH24: MM :ss’
select * from ly_sbqb_czrz where czsj > to_date(‘2018-04-22 23:59:59′,’yyyy-MM-dd HH24:mi:ss’) ok
 
 
SQLPLUS/AS SYSDBA does not solve the problem, but creates a PDB database to solve the problem
 
1. Can you use SHOW PDBS to confirm which PDBs are available?
 
[sql] view plain copy
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
———- —————————— ———- ———-
2 PDB$SEED READ ONLY NO
3 TESTP1 MOUNTED
SQL>
In the figure above, PDB$SEED is not a PDB but a template for a PDB, and the state is always Read Only. TestP1 is a PDB.
 
 
 
2. Switch to TestP1.
 
[sql] view plain copy
SQL> alter session set container=PDBORCL;
Session altered.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
———- —————————— ———- ———-
3 TESTP1 MOUNTED
SQL>
 
3. Cut back to CDB.
 
[sql] view plain copy
SQL> alter session set container=CDB$ROOT;
Session altered.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
———- —————————— ———- ———-
2 PDB$SEED READ ONLY NO
3 TESTP1 MOUNTED
SQL>
 
10. Import database files with different user names
Imp userid = [usernam]/[password]. @ ORCL_192 168.1.2 fromuser = [old_usernam] touser = [usernam] file = e: \ data. DMP
 
Alter tablespace size increment
alter database datafile ‘D:\APP\ORCL\ORADATA\ORCL\LY_QMP.ORA’ autoextend on next 100m maxsize 5120M;
Too much will report errors
ORA-03206: Maximum file size of block (6553600) in AUTOEXTEND clause out of range
03206. 00000 – “maximum file size of (%s) blocks in AUTOEXTEND clause is out of range”
 
ORA-28040 No Matching Authentication Protocol (ORA-28040 No Matching Authentication Protocol
1. The program replaces OJDBC14 with OJDBC7
2. Download 12c client instantclient_12_1
D:\instantclient_12_1
D:\instantclient_12_1\oci.dll

 
 

The solution to the error of [Oracle] ora-00054

Error message:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
 
Key words: ORA-00054 lock wait
 
The table cannot be truncated by another process if the table is not committed after the INSERT message is sent.
For example:
Process A creates A new table, inserts A row of data, but does not commit.

ORA-00054: ORA-00054 ORA-00054: ORA-00054: ORA-00054: ORA-00054: ORA-00054: ORA-00054: ORA-00054: ORA-00054: ORA-00054

The truncate of process B can only be executed after process A commits or after the resource is released.


Note that this situation is different from two processes operating on a resource at the same time (e.g., UPDATE on the same row). When two processes are operating on a resource at the same time, the second operation will get stuck (waiting).
You can find the process that holds the resource, commit the resource and release it. If you cannot commit, you can confirm and kill it.

SQL> select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;


Note that not all the information that appears after using the above statement is the problem process, because normal operation on the table as long as there is a hold resource in the query will be selected, so you can use this command several times to check whether the resource has been held, and you can look at the table name below to help confirm.
Query for sid and serial#.

SQL> select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;

KILL the session process.

Oracle 12C installation process related errors and Solutions

For the latest version of Oracle 12c database, we will encounter many problems in the process of installing and building the database. Here I will summarize the problems I encountered, and give the corresponding solutions.


1.ORA-12500: TNS: Listener could not start the dedicated server process
As the name implies, this type of problem relates to the associated listening service

sqlplus/noolog
nn /as sysdba
s>up
conn /as sysdba
startup
conn /as sysdba
startup ORCL database associated with the service, if not opened in the CMD check can be through the task manager in the service column to find the relevant service to open the restart, ORACLESSWrite – ORACLESService – Listener – ORACLEScheduler -, generally is one of the service and Listener did not start, the service can be resolved after the restart. To reconfigure listeners, open the Net Configuration Assistant and reconfigure existing listeners. Open the netmanager and check whether the user’s localhost port 1521 is not abnormal.


ORA-12560:TNS: Protocol oracer error
Error problems can be caused by three factors:
The listening service is not up.
Windows platform a operation as follows: Start – Program – Management Tools – Services, open the Services Panel, start OracleHome92TNSListener service. The database instance is not up.
Windows platform: Start – Programs – Management Tools – Services, open the Services panel, launch Oracle Server XXXX,XXXX is your Database SID. Registry problems.
regedit, then go to HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0 and set the environment variable ORACLE_SID to XXXX. XXXX is your database SID. Or just to the right of My Computer, Properties — Advanced — Environment Variable — System Variable — New, Variable Name = ORACLE_SID, Variable Value =XXXX,XXXX is your Database SID. ORACLE_SID =XXXX. ORACLE_SID =XXXX. ORACLE_SID =XXXX.


3. Port occupancy problem
CMD to perform netstat ano | findstr searches in 1521 CMD perform netstat – ano find localaddress port
Query to the PID of the executing process
Taskkill /pid ** /f Open the services panel, find the running pid process and terminate it
End the process, and the occupied port will be released


4.ORA-12505 Listener refused the connection

    sid, user name, etc. Make sure it matches the database you created — restart your computer, release the used port 1521 — restart Oracle Develpoer — then run CMD, open a command prompt, and type LSNRCTL to run stop first. Then start — Open Resource Manager
    and run C:\ Oraclexe \app\ Oracle \product\10.2.0\ Server \BIN\tnslsnr.exe
    ey_local_machine \ System \CurrentControlSet\Services\ OraclexetNSListener
    I>Path key value: C: \ oraclexe \ app \ oracle \ product \ 10.2.0 \ server \ BIN \ TNSLSNR exe


    Temarily sorted out the above four problems, in general, to ensure that the associated monitoring service is normally opened, the server SID and other configurations are correct, can test the successful connection.

When installing oracle12c, the problem of “unable to check whether the specified location is on CFS” appears

This problem occurred after uninstalling Oracle12c.
others said need to modify the host file, restart the works after modification. Then changed the computer name, after reboot easy to use.
In other cases, the installation of Oracle will get stuck. When exiting and reinstalling Oracle, select “New System User”, which is easy to use.

Oracle11gr2 database suddenly “TNS no listener” protocol adapter error

Just to be clear, this one is so fucking stupid.
lsnrctl status
TNS-12541 no listening program
TNS-12560 protocol adapter error
TNS-00511 no listener program
 
According to the online solution I have various reconfiguration listening, but none of them work.
Finally, I saw a post where he accidentally found that the listening log had reached 4G. I looked at mine and sure enough it was the same. I didn’t hesitate to delete it and restart the service. Solve the problem.
 
Log position app/administrator/diag/TNSLSNR/XXXXXX/listener/trace/listener. The log

Use of HQL query.list () is a null pointer exception, but the database can find out the result

HQL uses query.List () as a null pointer exception, but the database can detect the result
Solutions:
Check that the database dialect is configured correctly in hibernate configuration
org.hibernate.dialect.OracleDialect

<property name="hibernateProperties">
	<props>
		<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
		<prop key="hibernate.show_sql">true</prop>
		<prop key="dynamic-update">true</prop>
		<prop key="hibernate.jdbc.batch_size">0</prop>
	</props>
</property>

Give common database dialects

RDBMS

dialect

DB2

org. Hibernate. The dialect. DB2Dialect

DB2 AS/400 org.hibernate.dialect.DB2400Dialect
DB2 OS390 org.hibernate.dialect.DB2390Dialect
PostgreSQL org.hibernate.dialect.PostgreSQLDialect
MySQL org.hibernate.dialect.MySQLDialect
MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 9i/10g org.hibernate.dialect.Oracle9Dialect
Sybase org.hibernate.dialect.SybaseDialect
Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Server org.hibernate.dialect.SQLServerDialect
SAP DB org.hibernate.dialect.SAPDBDialect
Informix org.hibernate.dialect.InformixDialect
HypersonicSQL org.hibernate.dialect.HSQLDialect
Ingres org.hibernate.dialect.IngresDialect
Progress org.hibernate.dialect.ProgressDialect
Mckoi SQL org.hibernate.dialect.MckoiDialect
Interbase org.hibernate.dialect.InterbaseDialect
Pointbase org.hibernate.dialect.PointbaseDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
Firebird org.hibernate.dialect.FirebirdDialect

java.sql.SQLException : IO error: socket read timed out!

When run the enterprise software mode configuration database to produce the error,
in one by one to eliminate error finally find out the reason stems from oracle listener service (OracleOraDb11g_home1TNSListener) has not started, the role of the service is the database need to remote access to start, I’m in the local PC CeShiPao project so no to this side.
successfully started.

Usage of NVL in SQL

, for example, in the figure above: NVL (p.mark, 0)
p.mark is a value of type number. If the mark score is null, the value is 0; if not null, the value of p.mark is **
An NVL function is a null value conversion function
NVL (expression 1, expression 2)
If expression 1 is null, NVL returns the value of expression 2; otherwise, it returns the value of expression 1. The purpose of this function is to convert a null value (NULL) into an actual value. The value of its expression can be numeric, character, or date. But expressions 1 and 2 must have the same data type.
Logarithmic font: NVL (COMM,0);
To character NVL(TO_CHAR(COMM), ‘No Commission’)
NVL for date type (HireDate,’ 31-DEC-99′)

Oracle error – ora-12519, TNS:no appropriate service handler found

Navicat Premium15 connection Oracle error Oracle error – ora-12519, TNS:no appropriate service handler found
most of the web said the solution was to modify the maximum number of connections, but I passed select count(*) from v$process; found that my connection number is only 30, there is no such thing as the preset number of 150, so it should not be this problem.
is found to be the Listener. Ora and tnsnames.ora files that have been modified before. Change the HOST value in the file to the local IP address, which was localhost before.
is hoping to help someone with this problem.

Creation and use of Oracle sequence

Creation of an Oracle sequence
CREATE SEQUENCE name
[br>]
[START WITH n]
[{MAXVALUE n>5 NOMAXVALUE}]0
1 2 [{MINVALUE n>6 NOMINVALUE}]3
4 [{CYCLE|NOCYCLE}]
[{CACHE n| NOCACHE}];
Parameter description:
INCREMENT BY– the step of a sequence change, that is, the step of the sequence, defaults to 1; Negative values indicate that the value of this Oracle sequence is decreasing in this step.
START WITH– – the initial value of the sequence, default is 1.
MAXVALUE – – the maximum that can be generated by the sequence. (default does not limit maximum: NOMAXVALUE — for increasing Oracle sequences, the maximum the system can produce is 10 to the 27th power; For descending sequences, the maximum value is -1)
MINVALUE – – the minimum value that can be generated by the sequence. (default does not limit minimum: NOMINVALUE)
CYCLE – – used to define whether a CYCLE (NOCYCLE: NOCYCLE, CYCLE: CYCLE) will occur when the value produced by the sequence reaches the limit value.
CACHE – – represents the number of cached sequences. Abnormal termination of the database may cause the sequence to be interrupted and discontinuous. The default value is 20.
Example:

CREATE SEQUENCE SEQ_DEMO INCREMENT BY 1 START WITH 1 NOMAXVALUE NOCYCLE NOCACHE

Use of Oracle sequences
currval – represents the current value of the sequence, the new sequence must be used once nextval to obtain the value, otherwise an error will be reported
nextval – represents the next value of the sequence. The first time a new sequence is used, the initial value of the sequence is obtained, and the set step increments start from the second use
The value of the query sequence:
select seq_name.[currval/nextval] seqno from dual;

1) dual : is a virtual table of oracle, not real.
2) seq_name : is the name given by the developer as a “sequence”, which is usually used to generate id Numbers.
3) seq_name.nextval : takes the next value of the sequence. If the current value of the sequence is 100, execute the above SELECT statement and seqNO becomes 101. One more time, seqno will get to 102… …

Conclusion:
To implement id autoincrement, Oracle needs to use sequence implementation. nextval must be called to generate a sequence value before using currval to see the current value. The starting value of the sequence must not be less than the minimum value; To create a loop sequence, the maximum value must be set; If a cached sequence is created, the cached value must satisfy the constraint formula: Max - min > =(cache value -1)* the value of each loop .

ORA-00907:missing right parenthesis

1. Error description

2. Error reason

create table t_stu_info(
    id int(10) primary key,
    name varchar2(20) not null
 );

Error, missing close parenthesis, int(10)

3. Solutions

create table t_stu_info(
    id int primary key,
    name varchar2(20) not null
 );

After removing the length of the data type after ID, no error will be reported; The ID data type length was also bracketed, but the Oracle client still prompts for an error