tag:blogger.com,1999:blog-62419170230155843452024-02-20T13:25:40.847-08:00Oracle, Linux, stuffFlorin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.comBlogger80125tag:blogger.com,1999:blog-6241917023015584345.post-15588351027719859762017-07-26T05:42:00.001-07:002017-07-26T05:44:50.306-07:00Display all the tables in an Oracle schema, with fk relations and number of records, for the parent and the child tables <span style="font-family: "courier new" , "courier" , monospace;">select a.owner powner, a.table_name tableswithoutpk,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.table_name ptable, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> count(*) c FROM ' || a.owner || '.' || </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> '"'||a.table_name||'"')),'/ROWSET/ROW/C')) pcount,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.constraint_name pkname, b.status pkstatus, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> c.table_name chtable, c.owner chowner, c.constraint_name </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> fkname, c.status fkstatus,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decode(c.table_name, null, null, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> count(*) c FROM ' || c.owner || '.' || </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> '"'||c.table_name||'"')),'/ROWSET/ROW/C'))) chCount </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> from all_tables a </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> left outer join all_constraints b on </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.owner='SCOTT' and b.constraint_type='P' and </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> a.table_name=b.table_name</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> left outer join all_constraints c on </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> c.R_constraint_name=b.constraint_name </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where a.owner='SCOTT' ;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">powner and tableswithoutpk - the owner and the name of the table, no matter if it has a primary key</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">ptable - the name of the parent table, is not null only if the table has a primary key</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">pcount - the number of records of the parent table</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">pkname - the name of the primary key constraint</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">pkstatus - the status of the primary key constraint</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">chtable, chowner - the name and the owner of the child table. They will be null if the parent table has no childs (foreign keys that references it). The owner is not necessarily the same with the owner of the parent.</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">fkname - the name of the foreign key constraint name</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;">chcount - the number of records of the child table</span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>
<span style="font-family: "trebuchet ms" , sans-serif;"><br /></span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-23910096494634135752017-07-26T04:11:00.001-07:002017-07-26T04:17:20.463-07:00How to empty all the tables in an Oracle schema, disregarding any foreign key The main problem when you want to empty all the tables in a schema is the foreign keys. It's pretty simple to disable them, but meanwhile the users can write some data, data that can lead to errors, without the enforced constraints.<br />
So, there it is a script, made to empty the tables, without disabling any foreign key. Pay attention to the posible foreign keys from another schema, this script is to be run under the sys user, and the tables from another schema, that reference your tables, from the schema wanted to be empty, will be emptied as well. The <i>ow </i>variable is containing the name of the schema owner.<br />
Enjoy!<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">declare</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">ow varchar2(100);</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">rcount number;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">begin </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">ow:='SCOTT';</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">rcount:=0;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">for i in (select * from (</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> select a.owner powner,a.table_name tableswithoutpk, b.table_name ptable, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || a.owner || '.' || '"'||a.table_name||'"')),'/ROWSET/ROW/C')) pcount,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.constraint_name pkname, b.status pkstatus, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> c.table_name chtable, c.owner chowner, c.constraint_name fkname, c.status fkstatus,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decode(c.table_name, null, null, to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || c.owner || '.' || '"'||c.table_name||'"')),'/ROWSET/ROW/C'))) chCount </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> from all_tables a </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> left outer join all_constraints b on b.owner=ow and b.constraint_type='P' and a.table_name=b.table_name</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> left outer join all_constraints c on c.R_constraint_name=b.constraint_name </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where a.owner=ow order by ptable</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> )</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where chcount is null</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> )</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> loop</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> null;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> execute immediate 'delete from '||i.powner ||'.'||i.tableswithoutpk;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> end loop;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> while true LOOP</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"> for i in (select * from (</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> select a.owner powner,a.table_name tableswithoutpk, b.table_name ptable, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || a.owner || '.' || '"'||a.table_name||'"')),'/ROWSET/ROW/C')) pcount,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.constraint_name pkname, b.status pkstatus, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> c.table_name chtable, c.owner chowner, c.constraint_name fkname, c.status fkstatus,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decode(c.table_name, null, null, to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || c.owner || '.' || '"'||c.table_name||'"')),'/ROWSET/ROW/C'))) chCount </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> from all_tables a </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> left outer join all_constraints b on b.owner=ow and b.constraint_type='P' and a.table_name=b.table_name</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> left outer join all_constraints c on c.R_constraint_name=b.constraint_name </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where a.owner=ow order by ptable</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> )</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where chcount >0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> loop</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> execute immediate 'delete from '||i.chowner||'.'||i.chtable;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> end loop;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> for i in (select * from (</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> select a.owner powner, a.table_name tableswithoutpk,b.table_name ptable, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || a.owner || '.' || '"'||a.table_name||'"')),'/ROWSET/ROW/C')) pcount,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.constraint_name pkname, b.status pkstatus, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> c.table_name chtable, c.owner chowner, c.constraint_name fkname, c.status fkstatus,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decode(c.table_name, null, null, to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || c.owner || '.' || '"'||c.table_name||'"')),'/ROWSET/ROW/C'))) chCount </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> from all_tables a </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> join all_constraints b on b.owner=ow and b.constraint_type='P' and a.table_name=b.table_name</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> join all_constraints c on c.R_constraint_name=b.constraint_name </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where a.owner=ow order by ptable</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> )</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where chcount =0 and pcount>0)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> loop</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> execute immediate 'delete from '||i.powner||'.'||i.ptable;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> end loop; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">dbms_output.put_line('444');</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> select sum(pcount) into rcount from </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> (</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> select * from (</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> select a.owner powner, a.table_name tableswithoutpk, b.table_name ptable, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || a.owner || '.' || '"'||a.table_name||'"')),'/ROWSET/ROW/C')) pcount,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> b.constraint_name pkname, b.status pkstatus, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> c.table_name chtable, c.owner chowner, c.constraint_name fkname, c.status fkstatus,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> decode(c.table_name, null, null, to_number(extractvalue(xmltype(dbms_xmlgen.getxml('SELECT count(*) c FROM ' || c.owner || '.' || '"'||c.table_name||'"')),'/ROWSET/ROW/C'))) chCount </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> from all_tables a </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> /*left outer */join all_constraints b on b.owner=ow and b.constraint_type='P' and a.table_name=b.table_name</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> /*left outer*/ join all_constraints c on c.R_constraint_name=b.constraint_name </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> where a.owner=ow order by ptable</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> )</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> )</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> ;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> EXIT WHEN rcount=0;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> END LOOP; </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">end;</span><br />
<br />
... and don't forget to commit!!<br />
If you want to make some exercises, using the SCOTT schema, you want to save somewhere the content of the SCOTT tables. Use these lines bellow:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"> </span><span style="font-family: "courier new" , "courier" , monospace;">begin</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">for i in (select * from all_tables where owner='SCOTT') loop</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> execute immediate 'create table '||i.table_name||' as select * from SCOTT.'||i.table_name;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> end loop;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">end;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/ </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
... creates the backup tables, under the sys schema<br />
<br />
<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">begin</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">for i in (select * from all_tables where owner='SCOTT') loop</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> execute immediate 'insert into scott.'||i.table_name||' select * from '||i.table_name;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> end loop;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">end;</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">/ </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
... reloads the SCOTT tables, for a future run...Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com1tag:blogger.com,1999:blog-6241917023015584345.post-29516104572068751032017-03-24T03:00:00.001-07:002017-03-24T03:00:06.647-07:00Grant select on all tables and views (except the invalid views) of a schema to another user<span style="font-family: "Courier New",Courier,monospace;">begin<br /> </span><br />
<span style="font-family: "Courier New",Courier,monospace;">for i in (select object_name from user_objects where object_type in ('TABLE','VIEW')) LOOP<br /> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> begin<br /> execute immediate 'grant select on '||i.object_name||' to </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> grantee_user';<br /> EXCEPTION</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> WHEN OTHERS THEN </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> dbms_output.put_line('err_num: '||SQLCODE);<br /> dbms_output.put_line('err_msg: '||SUBSTR(SQLERRM, 1, 100));<br /> dbms_output.put_line('object_name: '||i.object_name);<br /> continue;<br /> END; <br /> end loop;<br />end;<br />/</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-40572693639715833562016-09-21T04:37:00.003-07:002016-09-21T04:37:39.832-07:00How to free swap in Linux<span style="font-family: "Trebuchet MS",sans-serif;">First, verify with <span style="font-family: "Courier New",Courier,monospace;">free</span> command how much swap it is used.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">If you want to free all the swap:</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">>swapoff -a</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">Meanwhile, verify from another command prompt the pace of swap freeing, running the <span style="font-family: "Courier New",Courier,monospace;">free</span> command on and on. </span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">>swapon -a </span><br />
<br />
<br />Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com1tag:blogger.com,1999:blog-6241917023015584345.post-31123121183604869622016-09-01T04:34:00.001-07:002016-09-01T04:34:31.280-07:00"ora - 02248 : invalid option for ALTER SESSION" when try to connect to database from Forms Builder 9.0.4If you run the Builder from Windows 7, don't bother to follow any advice from any site on the net, the solution is to change the OS. It's true the problem comes from the combination builder - database, but you can't do anything but what i said above to cope with.<br />
Take the 9.0.4 kit (if you have it, because i think it is imposible to download nowadays) and install it on, let's say, win xp!<br />
Good luck!Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-69860315892641755692016-07-14T05:51:00.003-07:002016-07-14T05:51:42.104-07:00The top 10 first hungriest queries<span style="font-family: "Courier New",Courier,monospace;">SELECT Disk_Reads DiskReads, Executions, SQL_ID, SQL_Text SQLText, <br /> SQL_FullText SQLFullText <br />FROM<br />(<br /> SELECT Disk_Reads, Executions, SQL_ID, LTRIM(SQL_Text) SQL_Text, <br /> SQL_FullText, Operation, Options, <br /> Row_Number() OVER <br /> (Partition By sql_text ORDER BY Disk_Reads * Executions DESC) <br /> KeepHighSQL<br /> FROM<br /> (<br /> SELECT Avg(Disk_Reads) OVER (Partition By sql_text) Disk_Reads, <br /> Max(Executions) OVER (Partition By sql_text) Executions, <br /> t.SQL_ID, sql_text, sql_fulltext, p.operation,p.options<br /> FROM gv$sql t, gv$sql_plan p<br /> WHERE t.hash_value=p.hash_value AND p.operation='TABLE ACCESS' <br /> AND p.options='FULL' AND p.object_owner NOT IN ('SYS','SYSTEM')<br /> AND t.Executions > 1<br /> ) <br /> ORDER BY DISK_READS * EXECUTIONS DESC<br />)<br />WHERE KeepHighSQL = 1<br />AND rownum <=10;</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-36211509013434192912016-07-08T02:34:00.002-07:002016-07-08T02:34:14.968-07:00Linux: Display the usage of processors and memory without provisioning values (the real usage)<span style="font-family: "Trebuchet MS",sans-serif;">Procs (two alternatives):</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}'</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-family: "Courier New",Courier,monospace;">grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'</span></span><br />
<br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">Memory:</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"> </span><br />
<span style="font-family: "Courier New",Courier,monospace;">ps aux | awk '{sum+=$6} END {print sum / 1024}'</span><br />Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-5727842775319354992016-03-24T02:58:00.001-07:002016-03-24T02:58:31.713-07:00Linux: reclaim your space after deleting some filesThe problem is a simple one, but very annoying one: one or some of the deleted file (usually some big one/ones) are still opened by their parent processes. So, look for that processes, kill them, and you'll notice the df command will report propper results.Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-47830967422396896072016-01-19T05:40:00.005-08:002016-01-19T05:43:55.460-08:00How to install Oracle APEX<span style="font-family: "trebuchet ms" , sans-serif;"><span style="font-family: "Courier New",Courier,monospace;">sqlplus / as sysdba<br />sql<span style="font-family: "trebuchet ms" , sans-serif;">> </span>SELECT dbms_xdb.gethttpport FROM dual;<br />sql> EXEC dbms_xdb.sethttpport(0);</span><br /><br /><span style="font-family: "Courier New",Courier,monospace;">>COL comp_name FOR A30<br />>SELECT comp_name, version, status FROM dba_registry WHERE comp_id='APEX';</span></span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><span style="font-family: "Courier New",Courier,monospace;"> </span></span><br />
<span style="font-family: "trebuchet ms" , sans-serif;">If there is already installed:</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cd $ORACLE_HOME/apex<br />$ sqlplus / as sysdba<br /><br />sql> @apxremov_con.sql</span><br />
<br />
<span style="font-family: "trebuchet ms" , sans-serif;">If the tablespace is not there already:<br /><br /><span style="font-family: "courier new" , "courier" , monospace;">CREATE TABLESPACE APEX DATAFILE '/u02/oradata/snap11g/apex_01.dbf'<br />SIZE 200M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 1000M LOGGING<br />EXTENT MANAGEMENT LOCAL<br />SEGMENT SPACE MANAGEMENT AUTO;<br /><br /> sql> @apexins APEX APEX TEMP /i/</span><br /> admin password :<br /><br /><span style="font-family: "courier new" , "courier" , monospace;">sqlplus / as sysdba<br />sql> @apxchpwd</span><br />Under the old apex versions you can edit the script summoned by the apxchpwd.sql (apxxepwd.sql) such as the password can be as strong or weak as you wish. Under the newer versions, you can decide this only from the admin interface.<br /><br /> embedded PL/SQL Gateway configuration (EPG)<br /><br /><span style="font-family: "courier new" , "courier" , monospace;">sql> @apex_epg_config.sql /u01/app/oracle/product/11.2.0.3/db_1</span><br /><br /> Update the APEX images for the new release<br /><br /><span style="font-family: "courier new" , "courier" , monospace;">sql> @apxldimg.sql /u01/app/oracle/product/11.2.0.3/db_1<br /><br />ALTER USER anonymous ACCOUNT UNLOCK;<br />ALTER USER xdb ACCOUNT UNLOCK;<br />ALTER USER apex_public_user ACCOUNT UNLOCK;<br />ALTER USER flows_files ACCOUNT UNLOCK;</span><br /> enable the Oracle XML DB HTTP Server port (8080):<br /><br /><span style="font-family: "courier new" , "courier" , monospace;"> EXEC dbms_xdb.sethttpport(8080);</span><br /><br />Enable remote HTTP connections (optional):<br /><span style="font-family: "courier new" , "courier" , monospace;">EXEC dbms_xdb.setListenerLocalAccess(l_access => FALSE);</span></span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-26187385682526943142016-01-14T07:46:00.003-08:002016-01-14T07:46:23.340-08:00ORA-39097: Data Pump job encountered unexpected error -12801 while expdp<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: white; display: inline ! important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">ORA-39097: Data Pump job encountered unexpected error -12801<span class="Apple-converted-space"> </span></span><br style="background-color: white; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;" /><span style="background-color: white; display: inline ! important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">ORA-39065: unexpected master process exception in MAIN<span class="Apple-converted-space"> </span></span><br style="background-color: white; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;" /><span style="background-color: white; display: inline ! important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">ORA-12801: error signaled in parallel query server P..., instance <instance_name><span class="Apple-converted-space"> </span></span><br style="background-color: white; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;" /><span style="background-color: white; display: inline ! important; float: none; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">ORA-01460: unimplemented or unreasonable conversion requested Job <job_name> stopped due to fatal error at <failure_time>.<span class="Apple-converted-space"> </span></span></span> <br />
<br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">The problem seems to be a bug and the solution can be an update to minimum 11.2.0.4 version.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">For me, the workaround was:</span><br />
<br />
> <span style="font-family: "Courier New",Courier,monospace;">alter system set <strong style="background-color: white; font-size: 13px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: 19.5px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;"><span class="Apple-converted-space"></span>PARALLEL_FORCE_LOCAL=TRUE;</strong></span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-1743087204758922222016-01-06T05:43:00.000-08:002016-01-06T07:34:05.481-08:00Create audit triggers for all the tables of a schema and audit tables in another schema<span style="font-family: "Trebuchet MS",sans-serif;">First, create the owner of the audit tables (in our scenario, will be "john_audit" and the audited schema will be "john"). Be aware that the audit user should mandatory name like audited name + "_audit". </span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">CREATE OR REPLACE PROCEDURE create_audit_tables (table_owner VARCHAR2)<br />IS<br /> CURSOR c_tables (<br /> table_owner VARCHAR2)<br /> IS<br />SELECT ot.owner AS owner, ot.table_name AS table_name<br /> FROM all_tables ot<br /> WHERE lower( ot.owner) = lower(table_owner)<br /> ;<br /><br /> aud_user varchar2(100);<br /> v_sql VARCHAR2 (8000);<br /> v_count1 number;<br /> v_count2 number;<br /> v_count NUMBER := 0;<br /> v_aud VARCHAR2 (30);<br /> n_count number;<br />BEGIN<br /> aud_user:=table_owner||'_AUDIT';<br /> select count(*) into v_count1 from dba_tables where lower(owner)=lower(table_owner);<br /> select count(*) into v_count2 from dba_tables where lower(owner)=lower(aud_user);<br /> v_count:=v_count1-v_count2;<br /> if v_count>0 then<br /> FOR r_table IN c_tables (table_owner)<br /> LOOP<br /> BEGIN<br /> v_aud := r_table.table_name;<br /> select count(*) into n_count from dba_tables where lower(table_name)=lower(v_aud) and lower(owner)=lower(aud_user);<br /> <br /> if n_count=0 then<br /> <br /> v_sql :=<br /> 'create table '||aud_user<br /> || '.'<br /> || v_aud<br /> || ' as select * from '<br /> || r_table.owner<br /> || '.'<br /> || r_table.table_name<br /> || ' where 0 = 1';<br /><br /> DBMS_OUTPUT.put_line ('Info: ' || v_sql);<br /><br /><br /> EXECUTE IMMEDIATE v_sql;<br /><br /> v_sql :=<br /> 'alter table '||aud_user||'.'<br /> || v_aud<br /> || ' add ( AUDIT_ACTION char(1), AUDIT_BY varchar2(50), AUDIT_AT TIMESTAMP)';<br /><br /> EXECUTE IMMEDIATE v_sql;<br /><br /> end if;<br /> <br /> -- v_count := c_tables%ROWCOUNT;<br /> EXCEPTION<br /> WHEN OTHERS<br /> THEN<br /> DBMS_OUTPUT.put_line (<br /> 'Failed to create table '<br /> || v_aud<br /> || ' due to '<br /> || SQLERRM);<br /> END;<br /> END LOOP;<br /> end if;<br /> IF v_count = 0<br /> THEN<br /> DBMS_OUTPUT.put_line ('No audit tables created');<br /> ELSE<br /> DBMS_OUTPUT.put_line (v_count || ' audit tables created.');<br /> END IF;<br />END;<br />/</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">Run the procedure (will create audit tables in audit schema only for the tables created after the last run):</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Trebuchet MS",sans-serif;"> </span> </span><br />
<span style="font-family: "Courier New",Courier,monospace;">begin<br /> create_audit_tables('john'); --it's not caps sensitive<br />end;<br />/</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">Now, a function which will gatter the columns together:</span><br />
<br />
<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">create or replace FUNCTION get_columns_for_table (<br /> table_owner VARCHAR2,<br /> t_name VARCHAR2,<br /> prefix VARCHAR2<br /> ) RETURN CLOB<br /> IS<br /> v_text CLOB;<br /> BEGIN<br /> FOR getrec IN (SELECT column_name<br /> FROM all_tab_columns<br /> WHERE table_name = t_name<br /> AND owner = table_owner<br /> AND data_type<>'BLOB')<br /> LOOP<br /> v_text := v_text<br /> || ','<br /> || prefix<br /> || getrec.column_name<br /> || CHR (10)<br /> || ' ';<br /> END LOOP;<br /><br /> RETURN ltrim(v_text,',');<br /> END;</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">And a function that will compare the old and new columns values, in order to find if an update applied. </span><br />
<br />
<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">create or replace function get_column_comparison (<br /> table_owner VARCHAR2,<br /> t_name VARCHAR2<br /> ) RETURN CLOB<br /> IS<br /> v_text CLOB;<br /> BEGIN<br /> FOR getrec IN (SELECT column_name<br /> FROM all_tab_columns<br /> WHERE table_name = t_name<br /> AND owner = table_owner<br /> AND data_type<>'BLOB')<br /> LOOP<br /> v_text := v_text<br /> || ' or( (:old.'<br /> || getrec.column_name<br /> || ' <> :new.'<br /> || getrec.column_name<br /> || ') or (:old.'<br /> || getrec.column_name<br /> || ' IS NULL and :new.'<br /> || getrec.column_name<br /> || ' IS NOT NULL) or (:old.'<br /> || getrec.column_name<br /> || ' IS NOT NULL and :new.'<br /> || getrec.column_name<br /> || ' IS NULL))'<br /> || CHR (10)<br /> || ' ';<br /> END LOOP;<br /> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> v_text := LTRIM (v_text, ' or');<br /> RETURN v_text;<br /> END; </span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Trebuchet MS",sans-serif;">And now the procedure that will produce the triggers:</span> </span><br />
<br />
<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">CREATE OR REPLACE PROCEDURE create_audit_triggers (table_owner VARCHAR2)<br />IS<br /> CURSOR c_tab_inc (<br /> table_owner VARCHAR2)<br /> IS<br /> SELECT ot.owner AS owner, ot.table_name AS table_name<br /> FROM all_tables ot<br /> WHERE lower (ot.owner) =lower ( table_owner)<br /> ;<br /> aud_user varchar2 (100);<br /> v_query VARCHAR2 (32767);<br /> v_count NUMBER := 0;<br />BEGIN<br /> aud_user:=table_owner||'_AUDIT';<br /> -- the triggers should have privileges in the audit schema<br /> FOR c IN (SELECT owner, table_name FROM all_tables WHERE lower(owner)=lower(aud_user)) <br /> LOOP<br /> EXECUTE IMMEDIATE 'grant select,insert,update on '||c.owner||'.'||c.table_name||' to '||table_owner;<br /> END LOOP;<br /> FOR r_tab_inc IN c_tab_inc (table_owner)<br /> LOOP<br /> BEGIN<br /><br /><br /> v_query :=<br /> 'CREATE OR REPLACE TRIGGER '<br /> ||table_owner<br /> || '.A'<br /> || substr(r_tab_inc.table_name,1,29)<br /> || ' AFTER INSERT OR UPDATE OR DELETE ON '<br /> || r_tab_inc.owner<br /> || '.'<br /> || r_tab_inc.table_name<br /> || ' FOR EACH ROW'<br /> || CHR (10)<br /> || 'DECLARE '<br /> || CHR (10)<br /> || ' v_user varchar2(30):=null;'<br /> || CHR (10)<br /> || ' v_action varchar2(15);'<br /> || CHR (10)<br /> || 'BEGIN'<br /> || CHR (10)<br /> || ' SELECT SYS_CONTEXT (''USERENV'', ''session_user'') session_user'<br /> || CHR (10)<br /> || ' INTO v_user'<br /> || CHR (10)<br /> || ' FROM DUAL;'<br /> || CHR (10)<br /> || ' if inserting then '<br /> || CHR (10)<br /> || ' v_action:=''INSERT'';'<br /> || CHR (10)<br /> || ' insert into '<br /> || aud_user<br /> || '.'<br /> || r_tab_inc.table_name<br /><br /> || '('<br /> || get_columns_for_table (r_tab_inc.owner,<br /> r_tab_inc.table_name,<br /> NULL)<br /> || ' ,AUDIT_ACTION,AUDIT_BY,AUDIT_AT)'<br /> || CHR (10)<br /> || ' values ('<br /> || get_columns_for_table (r_tab_inc.owner,<br /> r_tab_inc.table_name,<br /> ':new.')<br /> || ' ,''I'',v_user,SYSDATE);'<br /> || CHR (10)<br /> || ' elsif updating then '<br /> || CHR (10)<br /> || ' v_action:=''UPDATE'';'<br /> || CHR (10)<br /> || ' if '<br /> || get_column_comparison (r_tab_inc.owner, r_tab_inc.table_name)<br /> || ' then '<br /> || CHR (10)<br /> || ' insert into '<br /> ||aud_user <br /> ||'.'<br /> || r_tab_inc.table_name<br /> || '('<br /><br /> || get_columns_for_table (r_tab_inc.owner,<br /> r_tab_inc.table_name,<br /> NULL)<br /> || ' ,AUDIT_ACTION,AUDIT_BY,AUDIT_AT)'<br /> || CHR (10)<br /> || ' values ('<br /> || get_columns_for_table (r_tab_inc.owner,<br /> r_tab_inc.table_name,<br /> ':new.')<br /> || ' ,''U'',v_user,SYSDATE);'<br /> || CHR (10)<br /> || ' end if;'<br /> || ' elsif deleting then'<br /> || CHR (10)<br /> || ' v_action:=''DELETING'';'<br /> || CHR (10)<br /> || ' insert into '<br /> ||aud_user<br /> ||'.'<br /> || r_tab_inc.table_name<br /> || '('<br /> || get_columns_for_table (r_tab_inc.owner,<br /> r_tab_inc.table_name,<br /> NULL)<br /> || ' ,AUDIT_ACTION,AUDIT_BY,AUDIT_AT)'<br /> || CHR (10)<br /> || ' values ('<br /> || get_columns_for_table (r_tab_inc.owner,<br /> r_tab_inc.table_name,<br /> ':old.')<br /> || ' ,''D'',v_user,SYSDATE);'<br /> || CHR (10)<br /> || ' end if;'<br /> || CHR (10)<br /> || 'END;';<br /><br /> DBMS_OUTPUT.put_line (<br /> 'CREATE TRIGGER '<br /> || REPLACE (r_tab_inc.table_name, 'TABLE_', 'TRIGGER_'));<br /><br /> EXECUTE IMMEDIATE v_query;<br /><br /> DBMS_OUTPUT.put_line (<br /> 'Audit trigger '<br /> || REPLACE (r_tab_inc.table_name, 'TABLE_', 'TRIGGER_')<br /> || ' created.');<br /><br /><br /> v_count := c_tab_inc%ROWCOUNT;<br /> EXCEPTION<br /> WHEN OTHERS<br /> THEN<br /> DBMS_OUTPUT.put_line (<br /> 'Failed to create audit trigger for '<br /> || r_tab_inc.owner<br /> || '.'<br /> || r_tab_inc.table_name<br /> || ' due to '<br /> || SQLERRM);<br /> END;<br /> END LOOP;<br /><br /> IF v_count = 0<br /> THEN<br /> DBMS_OUTPUT.put_line ('No audit triggers created');<br /> END IF;<br />END; <br />/</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">Notice the sequence which grant the audited user to modify any table from the audit schema, created before with the <span style="font-family: "Courier New",Courier,monospace;">create_audit_tables</span> procedure.</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;">Now, all you have to do is to run the procedure and you will create as many triggers as tables they are. The triggers will be either created or replaced, so the procedure will run for every single table in the schema, no mother if it was created after the last run of the </span><br /><span style="font-family: "Courier New",Courier,monospace;">create_audit_tables <span style="font-family: "Trebuchet MS",sans-serif;">procedure or not.</span></span><br />
<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">begin<br />CREATE_AUDIT_TRIGGERS('john');<br />end;<br />/</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-31002048631249323242016-01-06T05:07:00.000-08:002016-01-06T05:07:02.990-08:00Create incrementing triggers for all the PKs from all the tables of a schemaThis is the procedure:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">CREATE OR REPLACE PROCEDURE create_pk_triggers (table_owner VARCHAR2)<br />IS<br /> CURSOR c_tables (<br /> table_owner VARCHAR2)<br /> IS<br /><br /> select * FROM ALL_CONS_COLUMNS <br /> WHERE <br /> CONSTRAINT_NAME IN ( SELECT CONSTRAINT_NAME FROM ALL_CONSTRAINTS where CONSTRAINT_TYPE = 'P') and <br /> lower(owner)=lower(table_owner);<br /><br /> v_sql VARCHAR2 (8000);<br /> v_count NUMBER := 0;<br /> v_aud VARCHAR2 (30);<br /> v_col varchar2(50);<br /><br /> <br />BEGIN<br /> FOR r_table IN c_tables (table_owner)<br /> LOOP<br /> BEGIN<br /> v_aud := r_table.table_name;<br /> v_col := r_table.column_name;<br /> v_sql :=<br /> 'CREATE OR REPLACE TRIGGER inspk_'<br /> ||substr(v_aud,1,24)<br /> || CHR (10)<br /> ||' before insert on '<br /> ||table_owner<br /> ||'.'<br /> || v_aud<br /> || CHR (10)<br /> || ' for each row begin '<br /> || CHR (10)<br /> || ' if inserting and :new.'<br /> || v_col<br /> || ' is null then ' <br /> || CHR (10)<br /> || ':new.'<br /> || v_col<br /> || ' :='<br /> || ' call4prop_seq.nextval;'<br /> || CHR (10) <br /> || ' end if;'<br /> || CHR (10)<br /> || ' end;'<br /> ;<br /><br /> DBMS_OUTPUT.put_line ('Info: ' || v_sql);<br /><br /> EXECUTE IMMEDIATE v_sql;<br /><br /><br /> v_count := c_tables%ROWCOUNT;<br /> EXCEPTION<br /> WHEN OTHERS<br /> THEN<br /> DBMS_OUTPUT.put_line (<br /> 'Failed to create table '<br /> || v_aud<br /> || ' due to '<br /> || SQLERRM);<br /> END;<br /> END LOOP;<br /><br /> IF v_count = 0<br /> THEN<br /> DBMS_OUTPUT.put_line ('No audit tables created');<br /> ELSE<br /> DBMS_OUTPUT.put_line (v_count || ' audit tables created.');<br /> END IF;<br />END;<br />/</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Trebuchet MS",sans-serif;">And here is how to run the procedure, using as a parameter the name of the schema owner (the capitals rule will not apply):</span></span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Trebuchet MS",sans-serif;"> </span> </span><br /><span style="font-family: "Courier New",Courier,monospace;">begin<br /> create_pk_triggers('username');<br />end;<br />/</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-15588516028929005922015-12-24T01:23:00.003-08:002015-12-24T01:23:20.438-08:00ORA-39006: internal error; ORA-39213: Metadata processing is not available;<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">> expdp schemas=...... dumpfile=.........</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production<br />With the Partitioning, OLAP, Data Mining and Real Application Testing options<br />ORA-39006: internal error<br />ORA-39213: Metadata processing is not available</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">Solution:</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span style="background-color: white;"><span style="display: inline ! important; float: none; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20.286px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">SQL> execute sys.dbms_metadata_util.load_stylesheets;</span></span></span></span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-40966963669506866052015-11-20T00:16:00.001-08:002015-11-20T00:16:13.682-08:00Kill all the blocking sessions (Real Application Cluster)<span style="font-family: "Trebuchet MS",sans-serif;">Give it a run as sysdba, from any instance:</span> <br />
<span style="font-family: "Courier New",Courier,monospace;">begin<br />for obj in (<br /> SELECT s.inst_id,<br /> s.sid,<br /> s.serial#,<br /> p.spid,<br /> s.username,<br /> s.program<br /> FROM gv$session s JOIN gv$process p </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> ON p.addr = s.paddr </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> AND p.inst_id = s.inst_id<br /> WHERE blocking_session is not null </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> and s.type != 'USER') <br /> loop<br /> execute immediate 'alter system kill session '''||obj.sid||','||obj.serial#||',@'||obj.inst_id||''''||' ';<br />end loop;<br />end;<br />/</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-32559750872850307492015-11-16T06:59:00.001-08:002016-01-12T06:26:22.269-08:00Grant select on all tables of a schema to another user<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><code style="background-color: #eeeeee; border: 0px none; margin: 0px; padding: 0px; white-space: inherit;"><span class="str" style="border: 0px none; color: maroon; margin: 0px; padding: 0px;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: large;"><span style="font-size: small;">Just replace the "user1" and "user2" names. User2 is the grantee and user1 the owner.</span> <br /><br /><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">BEGIN<br />FOR c IN (SELECT owner, table_name FROM all_tables WHERE owner='user1') LOOP<br /> EXECUTE IMMEDIATE 'grant select on '||c.owner||'.'||c.table_name||' to user2';<br /> END LOOP;<br />END;</span></span></span></span></span></code></span></span><br />
<br />
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><code style="background-color: #eeeeee; border: 0px none; margin: 0px; padding: 0px; white-space: inherit;"><span class="str" style="border: 0px none; color: maroon; margin: 0px; padding: 0px;">and for all privileges: </span></code></span></span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><code style="background-color: #eeeeee; border: 0px none; margin: 0px; padding: 0px; white-space: inherit;"><span class="str" style="border: 0px none; color: maroon; margin: 0px; padding: 0px;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: large;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><code style="background-color: #eeeeee; border: 0px none; margin: 0px; padding: 0px; white-space: inherit;"><span class="str" style="border: 0px none; color: maroon; margin: 0px; padding: 0px;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: large;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">BEGIN<br />FOR c IN (SELECT owner, table_name FROM all_tables WHERE owner='user1') LOOP<br /> EXECUTE IMMEDIATE 'grant all privileges on '||c.owner||'.'||c.table_name||' to user2';<br /> END LOOP;<br />END;</span></span></span></span></span></code></span></span> </span></span></span></span></span></code></span></span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-42597131715825836222015-11-13T04:44:00.003-08:002015-11-13T04:44:26.368-08:00ORA-31202: DBMS_LDAP: LDAP client/server error: Sizelimit exceeded<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">The problem is a parameter of the LDAP Server: MaxPageSize.</span></span><br />
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span></span>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">On the server:</span></span><br />
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><br /></span></span>
<pre class="sbody-pre" style="background-color: white; border: 1px solid rgb(230, 230, 230); box-sizing: border-box; color: black; display: block; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; margin-bottom: 12px; margin-top: 12px; overflow: auto; padding: 32px; text-align: start; text-indent: 0px; text-transform: none; widows: 1; word-break: break-all; word-spacing: 0px; word-wrap: break-word;"><span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">c:\>ntdsutil.exe
ntdsutil: Ldap policies
ldap policy: connections
server connections: Connect to server ServerName
Binding to ServerName ...
Connected to ServerName using credentials of locally logged on user
server connections: q
ldap policy: Show Values
Policy Current(New)
MaxPoolThreads 8
MaxDatagramRecv 1024
MaxReceiveBuffer 10485760
InitRecvTimeout 120
MaxConnections 5000
MaxConnIdleTime 900
MaxActiveQueries 20
MaxPageSize 1000
MaxQueryDuration 120
MaxTempTableSize 10000
MaxResultSetSize 262144
MaxNotificationPerConn 5
ldap policy: set MaxPageSize to 100000
ldap policy: Commit Changes
ldap policy: Show Values
Policy Current(New)
MaxPoolThreads 8
MaxDatagramRecv 1024
MaxReceiveBuffer 10485760
InitRecvTimeout 120
MaxConnections 5000
MaxConnIdleTime 900
MaxActiveQueries 20
MaxPageSize 100000
MaxQueryDuration 120
MaxTempTableSize 10000
MaxResultSetSize 262144
MaxNotificationPerConn 5
ldap policy: q
ntdsutil: q
Disconnecting from ServerName</span></span></pre>
Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-63093133700803624192015-10-06T04:54:00.000-07:002015-10-06T04:55:22.406-07:00How to kill all the sessions of a user, from all the instances of a RAC<span style="font-family: "Trebuchet MS",sans-serif;">Shortly, connect as sys and run the following script:</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">begin<br />for objects in (select sid, serial#,inst_id from gv$session where username='USER_TO_KILL') loop<br />EXECUTE IMMEDIATE 'alter system kill session '''||objects.sid||','||objects.serial#||',@'||objects.inst_id||''''||' immediate';<br />end loop;<br />end;</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-40069617516791278622015-09-18T04:43:00.002-07:002015-10-15T05:29:12.287-07:00How to authenticate with LDAP in Oracle APEX<span style="font-family: "Trebuchet MS",sans-serif;">First, create an Access Control List (ACL). Let's assume the owner of the application is 'userapp'. The ACL will pe granted to APEX04000 user (first, check the name of the apex user with 'select username from dba_users'), and then a privilege will be added for USERAPP. The ip of the LDAP server is 192.168,132,12, but, of course, better way is to use the name instead of the ip. Your call. The LDAP port is 389.</span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> BEGIN<br /> DBMS_NETWORK_ACL_ADMIN.create_acl (<br /> acl => 'ldap_acl_file.xml', <br /> description => 'ACL to grant access to LDAP server',<br /> principal => 'APEX_040000',<br /> is_grant => TRUE, <br /> privilege => 'connect',<br /> start_date => SYSTIMESTAMP,<br /> end_date => NULL);<br /><br /> DBMS_NETWORK_ACL_ADMIN.assign_acl (<br /> acl => 'ldap_acl_file.xml',<br /> host => '192.168.132.12', <br /> lower_port => 389,<br /> upper_port => NULL);<br /><br />DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> acl => 'ldap_acl_file.xml',<br /> principal => 'USERAPP',<br /> is_grant => true,<br /> privilege => 'connect', <br /> position => NULL, <br /> start_date => NULL,<br /> end_date => NULL);<br /> <br /> COMMIT;<br />END;</span><br />
/ <br />
Now, under the APPUSER scheme let's create the authentication function:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">CREATE OR REPLACE FUNCTION appuser.ldap_auth(<br /> p_username IN VARCHAR2,<br /> p_password IN VARCHAR2<br />)<br />RETURN BOOLEAN IS<br /> l_ldap_host VARCHAR2(256) := '192.168.132.12';<br /> l_ldap_port VARCHAR2(256) := '389';<br /> l_ldap_base VARCHAR2(256) := 'dc=domain,dc=ro';<br /> l_dn_prefix VARCHAR2(100) := ''; -- here you can mention </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> -- some peculiar group, </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> -- under your LDAP directory.<br /><br /> l_retval PLS_INTEGER;<br /> l_session DBMS_LDAP.session;<br />BEGIN<br /> -- Choose to raise exceptions.<br /> DBMS_LDAP.use_exception := TRUE;<br /> </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> -- Connect to the LDAP server.<br /> l_session := DBMS_LDAP.init(hostname => l_ldap_host,<br /> portnum => l_ldap_port);<br /> <br /> l_retval := DBMS_LDAP.simple_bind_s(ld => l_session,<br /> dn => l_dn_prefix || p_username,<br /> passwd => p_password);<br /> <br /> -- No exceptions mean you are authenticated.<br /> RETURN TRUE;<br />EXCEPTION<br /> WHEN OTHERS THEN<br /> -- Exception means authentication failed. <br /> l_retval := DBMS_LDAP.unbind_s(ld => l_session);<br /> APEX_UTIL.set_custom_auth_status(p_status => 'Incorrect username and/or password');<br /> RETURN FALSE; <br />END;<br />/</span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;">Now, it's time to use the function. Make an authorization scheme, under the Application Builder -> Shared Components -> Authentication Schemes (don't use the LDAP template scheme, just make an ordinary authentication scheme) and the most important thing to do is to put in the Authentication Function box the following text: "return ldap_auth;"</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Trebuchet MS",sans-serif;">And that's all, you will authenticate with the LDAP credentials.</span> </span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-61827255288221599552015-09-16T08:04:00.001-07:002015-09-16T08:05:17.042-07:00Recover a standby database from archived logs gap (ORA-16783: cannot resolve gap for database ....)<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">First, identify de SCN where the standby has lost the pace</span></span><br />
<br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"> select current_scn from gv$database;</span></span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"> CURRENT_SCN<br />-----------<br /> 2320214727</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">Of course, the SCN of the primary database is higher and the gap could be pretty big.</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">dgmgrl</span></span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;">
<span style="font-size: small;"> </span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Copyright (c) 2000, 2009, Oracle. All rights reserved.</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Welcome to DGMGRL, type "help" for information.</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL> connect sys</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Password:</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Connected.</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL> show configuration;</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Configuration - DGC</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
Protection Mode: MaxAvailability</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
Databases:</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
primary - Primary database</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
Error: ORA-16810: multiple errors or warnings detected for the database</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
- Physical standby database</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Fast-Start Failover: DISABLED</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Configuration Status:</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">ERROR</span></span></div>
<br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL> edit database 'standby' set state='APPLY-OFF';</span></span><br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
</div>
<br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">on the primary:</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">rman target / </span></span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">RMAN> run</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">2> {</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">3> allocate channel ch1 type disk;</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">4> allocate channel ch2 type disk;</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">5> backup incremental from scn </span></span><span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">2320214726</span></span> database format '/home/oracle/standby_%d_%t_%c_%p';</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">6> }</span></span></div>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">copy the backup pieces on the standby file system</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">on the standby:</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">RMAN> catalog start with '/home/oracle/bkp';</span></span><br />
<br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">(of course, be careful with the locations, use your own instead of ....)</span></span><br />
<br />
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">RMAN> run</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">2> {</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">3> allocate channel ch1 type disk;</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">4> recover database noredo;</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">5> }</span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
</div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"> on the primary:</span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span></div>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">SQL> alter database create standby controlfile as '/home/oracle/bkp/standby.ctl';</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;">
</span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
Database altered.</span></span></div>
</div>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">copy the controlfile on the standby</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">stop the standby database, doesn't matter how</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">start it nomount</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">on the standby:</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">rman target /</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">RMAN> restore controlfile from '/home/oracle/bkp/standby.ctl';</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">alter database mount</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">RMAN> CATALOG START WITH '+standby_DATA1/standby/DATAFILE/';</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">RMAN> SWITCH DATABASE TO COPY;</span></span><br />
<br />
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><code>SQL> ALTER DATABASE CLEAR LOGFILE GROUP 1; </code><br />
<code>SQL> ALTER DATABASE CLEAR LOGFILE GROUP 2; </code><br />
<code>SQL> ALTER DATABASE CLEAR LOGFILE GROUP 3;</code></span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><code>SQL> ALTER DATABASE CLEAR LOGFILE GROUP 4;</code><br />
<code>....</code></span></span></div>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">
</span></span><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<br />
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">$ dgmgrl </span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL for Linux: Version 11.2.0.2.0 - 64bit Production</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Copyright (c) 2000, 2009, Oracle. All rights reserved.</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Welcome to DGMGRL, type "help" for information.</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL> connect sys</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Password:</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Connected.</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">DGMGRL> edit database 'standby' set state='APPLY-ON';</span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span>
<div class="MsoNormal" style="margin: 0cm 0cm 0pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Succeeded.</span></span></div>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">sqlplus / as sysdba</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILE</span></span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;"><br /></span></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">Now everything should be ok</span></span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-4200003373079806982015-06-23T06:25:00.004-07:002015-06-23T06:39:22.748-07:0012c Management Agent Silent Installation<div class="post-headline" style="background-color: white; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
<h1 style="background: rgb(255, 255, 255) none repeat scroll 0% 0%; color: #a91106; margin: 0px; padding: 0px;">
</h1>
</div>
<div class="post-bodycopy clearfix" style="background-color: white; color: black; display: block; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; min-width: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Grid Control hostname: grid.</span></span></div>
<div class="post-bodycopy clearfix" style="background-color: white; color: black; display: block; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; min-width: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">The managed host: standby (this was the purpose, in my case, a standby server).</span></span><br />
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"> Put the proper settings into /etc/hosts files, on both machines.</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">On the grid:</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">cd /u01/app/oracle/Middleware/oms</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">cd bin</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span class="Apple-converted-space"></span>./emcli login -username=sysman -password=<i>pass</i></span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Login successful</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: small;">Synchronize EMCLI</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span class="Apple-converted-space"></span>./emcli sync</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Synchronized successfully</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Check the platforms for which the Management Agent software is available on the OMS host</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span class="Apple-converted-space"> </span>./emcli get_supported_platforms</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Getting list of platforms …</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Check the logs at /u01/app/oracle/Middleware/oms/bin/agent.log</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">About to access self-update code path to retrieve the platforms list..</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Getting Platforms list …</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">———————————————–</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Version = 12.1.0.1.0</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"> Platform = Linux x86-64</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">———————————————–</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Platforms list displayed successfully.</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Download the Management Agent software from Oracle Software Library to a temporary directory on the OMS host</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span class="Apple-converted-space"> </span><span style="font-family: "Courier New",Courier,monospace;">./emcli get_agentimage -destination=/u01/app/oracle/agent_software -platform=”Linux x86-64″ -version=”12.1.0.1.0″</span></span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Platform:Linux x86-64</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Destination:/u01/app/oracle/agent_software</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"> === Partition Detail ===</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Space free : 14 GB</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Space required : 1 GB</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Check the logs at /u01/app/oracle/agent_software/get_agentimage_2012-04-15_22-50-00-PM.log</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Setting property ORACLE_HOME to:/u01/app/oracle/Middleware/oms</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">calling pulloneoffs with arguments:/u01/app/oracle/Middleware/oms/u01/app/oracle/Middleware/oms/sysman/agent/12.1.0.1.0_AgentCore_226.zip12.1.0.1.0linux_x64</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Check this logs for more information: /u01/app/oracle/Middleware/oms/sysman/prov/agentpush/logs</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span class="Apple-converted-space"></span><span style="font-family: "Courier New",Courier,monospace;">[oracle@gridcontrol agent_software]$ cd /u01/app/oracle/agent_software<br />[oracle@gridcontrol agent_software]$ ll<br />total 285476<br />-rw-r----- 1 oracle oinstall 292032498 Jun 23 06:49 12.1.0.1.0_AgentCore_226.zip<br />-rw-r--r-- 1 oracle oinstall 1806 Jun 23 06:49 get_agentimage_2015-06-23_06-48-39-AM.log<br />[oracle@gridcontrol agent_software]$</span></span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"></span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Transfer the downloaded zip file to the host where you would like to install the 12c management agent</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">scp 12.1.0.1.0_AgentCore_226.zip<span class="Apple-converted-space"> </span>oracle@standby:</span><span style="font-size: small;">/u01/app/oracle/agent_software</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Unzip the file on the target host</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Check the directory contents</span></span></div>
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">[oracle@standby ~]$ cd /u01/app/oracle/agent_software<br />[oracle@standby agent_software]$ ll<br />total 571528<br />-rw-r----- 1 oracle oinstall 292032498 Jun 23 14:34 12.1.0.1.0_AgentCore_226.zip<br />-rwxr-xr-x 1 oracle oinstall 7630039 Jun 23 13:48 12.1.0.1.0_PluginsOneoffs_226.zip<br />-rw-rw-r-- 1 oracle oinstall 284323730 Feb 11 2012 agentcoreimage.zip<br />-rw-r--r-- 1 oracle oinstall 0 Jun 23 15:08 agentDeploy_2015-06-23_15_08_19.err<br />-rw-r--r-- 1 oracle oinstall 137910 Jun 23 15:08 agentDeploy_2015-06-23_15_08_19.log<br />-rw-r--r-- 1 oracle oinstall 0 Jun 23 15:11 agentDeploy_2015-06-23_15_11_20.err<br />-rw-r--r-- 1 oracle oinstall 125429 Jun 23 15:11 agentDeploy_2015-06-23_15_11_20.log<br />-rw-r--r-- 1 oracle oinstall 0 Jun 23 15:12 agentDeploy_2015-06-23_15_12_06.err<br />-rw-r--r-- 1 oracle oinstall 125429 Jun 23 15:12 agentDeploy_2015-06-23_15_12_06.log<br />-rw-r--r-- 1 oracle oinstall 0 Jun 23 15:13 agentDeploy_2015-06-23_15_13_03.err<br />-rw-r--r-- 1 oracle oinstall 70832 Jun 23 15:13 agentDeploy_2015-06-23_15_13_03.log<br />-rwxrwxr-x 1 oracle oinstall 17998 Feb 11 2012 agentDeploy.sh<br />-rw-rw-r-- 1 oracle oinstall 145 Feb 11 2012 agentimage.properties<br />-rw-rw-r-- 1 oracle oinstall 4039 Jun 23 15:13 agent.rsp<br />drwxr-xr-x 7 oracle oinstall 4096 Jun 23 13:48 plugins<br />-rwxr-xr-x 1 oracle oinstall 223 Jun 23 13:48 plugins.txt<br />-rwxr-xr-x 1 oracle oinstall 145976 Feb 11 2012 unzip</span></span><br />
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Edit the response file agent.rsp (mind the proper password)</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">OMS_HOST=”grid”</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">EM_UPLOAD_PORT=”4900″</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">AGENT_REGISTRATION_PASSWORD=”<i>password</i>”</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">AGENT_INSTANCE_HOME=”/u01/app/oracle/agent12g/agent_inst”</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">AGENT_PORT=”3872″</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">ORACLE_HOSTNAME=”standby”</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Run the agent deployment script</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">><span class="Apple-converted-space"> </span><span style="font-family: "Courier New",Courier,monospace;">./agentDeploy.sh AGENT_BASE_DIR=/u01/app/oracle/agent12g RESPONSE_FILE=/u01/app/oracle/agent_software/agent.rsp </span></span></span></div>
After tons of feedback, assuming that all is ok:<br />
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">> su -</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">> <span class="Apple-converted-space"> </span>/u01/app/oracle/agent12g/core/12.1.0.1.0/root.sh</span></span><br />
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Finished product-specific root actions.</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">/etc exist</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">Finished product-specific root actions.</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Check the status of the agent on the target host where it has been deployed</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<br /></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">>cd /u01/app/oracle/agent12g/core/12.1.0.1.0/bin</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">><span class="Apple-converted-space"> </span>./emctl status agent</span></span></div>
</div>
<div class="post-bodycopy clearfix" style="background-color: white; color: black; display: block; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; min-width: 0px; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">........................... bla bla ............ </span></span><br />
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">—————————————————————</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Agent is Running and Ready</span></span></div>
<div style="display: block; margin: 1em 0px; padding: 0px;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">Enjoy!</span></span></div>
</div>
Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-16867702779923765342015-06-19T03:13:00.002-07:002015-06-19T03:13:16.186-07:00VMWare tools problem: "host software version may not be compatible with the upgrader"<span style="font-family: "Trebuchet MS",sans-serif;">Solution</span>:<br />
<br />
<br /><div style="-webkit-text-stroke-width: 0px; background-color: white; border: 0px none; color: #666666; font-family: proxima-nova, Arial, sans-serif; font-size: 14px; font-stretch: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; margin: 2px; min-height: 8pt; orphans: auto; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 1; word-spacing: 0px;">
<br /></div>
<div style="background-color: white; border: 0px none; color: #666666; font-size: 14px; font-stretch: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; margin: 2px; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 1; word-spacing: 0px;">
<span style="font-family: "Courier New",Courier,monospace;">tar -xzf VMwareTools-9.4.10-2068191.tar.gz</span></div>
<div style="background-color: white; border: 0px none; color: #666666; font-size: 14px; font-stretch: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; margin: 2px; min-height: 8pt; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 1; word-spacing: 0px;">
<br /></div>
<div style="background-color: white; border: 0px none; color: #666666; font-size: 14px; font-stretch: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; margin: 2px; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 1; word-spacing: 0px;">
<span style="font-family: "Courier New",Courier,monospace;">cd vmware-tools-distrib</span></div>
<div style="background-color: white; border: 0px none; color: #666666; font-size: 14px; font-stretch: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; margin: 2px; min-height: 8pt; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 1; word-spacing: 0px;">
<br /></div>
<div style="background-color: white; border: 0px none; color: #666666; font-size: 14px; font-stretch: inherit; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; margin: 2px; padding: 0px; text-align: left; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 1; word-spacing: 0px;">
<span style="font-family: "Courier New",Courier,monospace;">./vmware-install.pl</span></div>
Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-75826699747629704242015-05-26T02:41:00.001-07:002015-05-26T02:41:11.731-07:00Oracle trigger: capturing one less column of a tableIf you want to fire a trigger when any of columns but one is updated, the solution ca be to put all the wanted columns in the script, but there is an easier way:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">CREATE OR REPLACE TRIGGER ....... before UPDATE or delete ON <br /> .......... REFERENCING old AS old new as new FOR EACH ROW<br />declare <br />...............................<br />BEGIN<br />...........................<br />if updating ('unwanted_column') then </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> null;<br /> else<br /> ........<i>the action of trigger</i>..........;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">end if;<br />exception<br />WHEN exc THEN<br />............</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> rollback;<br />END;<br />/</span><br />
<br />
<br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;">Be aware that if you use </span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">if not updating ('unwanted_column') then</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> ........<i>the action of trigger</i>..........;</span><br />
<span style="font-family: "Courier New",Courier,monospace;">end if;</span><br />
<br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-family: "Courier New",Courier,monospace;">you'<span style="font-family: "Trebuchet MS", sans-serif;">ll notice, when you update two or more columns, and the unwanted column is not included, anyway, the condition will not be satisfied and the action will not be done. Only in the case of updating one column will succeed, which is not a solid solution.</span></span></span><br />
<span style="font-family: "Trebuchet MS", sans-serif;"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: "Trebuchet MS", sans-serif;">So, use the condition somehow that the action will be on the ELSE </span></span>branch.</span><br />Enjoy!Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-73804338837390902192015-05-20T01:41:00.002-07:002015-05-20T01:41:27.416-07:00ORA-00054: resource busy and acquire with NOWAIT specified<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="color: black;">First of all, i must say this message maybe is not really scary,
because you might think with some patience the problem can be overridden. Well,
there is a possible scenario giving some headaches to a DBA:</span><span></span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;">alter table tn disable constraint tnc;</span></span><span></span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="color: black;">Everything is fine 'till now, you have disabled a constraint in
order to update some data.</span><span></span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span>After all these updates, and after you
verify the data is compliant with the bussiness rules enforced by the
constraint tnc:</span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;"><span style="color: black;">alter table tn enable constraint tnc;</span><span></span></span></span></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-family: "Courier New",Courier,monospace;"><span style="font-size: small;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> </span><span style="background: none repeat scroll 0% 0% white; color: black;">ORA-00054: resource busy and acquire with NOWAIT
specified</span></span><span></span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;">Now you are in serious trouble. Working hours
mean lots of data inserted in your tables, not anymore protected by that constraint, and the users can broke the bussiness rule from now.</span></span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;">Of course, you may say the same problem can occur during that few seconds while you ran the two DDL commands and the DML commands which modified th table tn. Agree, was not a good practice way of doing things, but this kind of manipulating data can be seen very often in practice, when a DBA or a developer doesn't care or can't wait for a maintenance window, in order to manipulate data, ignoring the possibility of any other session, locking a table.</span></span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;"></span></span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;"></span></span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;">Unfortunately, there isn't any complete solution for this problem. You can run the following code (for Oracle <10g), which tries for n minutes to achieve the lock on the table and run the DDL command:<br />
<br />
</span><span></span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;">DECLARE</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> is_ok BOOLEAN;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> t_l EXCEPTION;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> PRAGMA EXCEPTION_INIT(t_l, -00054);</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> start_time DATE;</span><span></span> -- the moment of the first cycle</span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"> no_min number; --how many minutes the program will run, trying to </span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"> -- achieve the lock</span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;">BEGIN</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> is_ok := FALSE;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> SELECT SYSDATE INTO start_time FROM DUAL;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"></span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> WHILE (NOT is_ok) AND (SYSDATE < start_time + no_min/24/60)</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> LOOP</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> BEGIN</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> EXECUTE IMMEDIATE ('</span><span style="color: black;"><span style="color: black;">alter table tn enable constraint tnc'</span>);</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> is_ok :=
TRUE;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> DBMS_OUTPUT.PUT_LINE('Succes!');</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> EXCEPTION </span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> WHEN t_l THEN</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> NULL;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> DBMS_LOCK.SLEEP(0.1);</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> END;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> END LOOP;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> IF is_ok = FALSE THEN</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> DBMS_OUTPUT.PUT_LINE('the constraint is still disabled!');</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"> END IF;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;"></span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;">END;</span><span></span></span></span></div>
<span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-size: x-small;"><span style="font-family: "Courier New",Courier,monospace;"><span style="color: black;">/</span></span></span><span></span></span></span></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;">
</span></span><div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;">For Oracle versions >10g, there is a parameter, ddl_lock_timeout</span><span style="color: black;"> </span>, doing the same job like the code from above. Any DDL command issued against a table will try for a number of seconds equal to <span style="background: none repeat scroll 0% 0% white; color: black;">ddl_lock_timeout.</span></span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: 0.0001pt;">
<span style="font-size: small;"><span style="font-family: "Trebuchet MS",sans-serif;"><span style="background: none repeat scroll 0% 0% white; color: black;">And there is another solution, involving the QUIESCE concept, but i don't like it and i don't recommend it to anyone. </span></span></span></div>
<div class="MsoNormal" style="line-height: 10.55pt; margin-bottom: .0001pt; margin-bottom: 0in; mso-margin-top-alt: auto;">
<span style="font-size: small;"><span style="background: none repeat scroll 0% 0% white; color: black; font-family: "Trebuchet MS","sans-serif";"><span style="font-family: "Trebuchet MS",sans-serif;">Good luck! </span></span></span><b><i><span style="background: white; color: black; font-family: "Trebuchet MS","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-fareast-font-family: "Times New Roman";"><br /></span></i></b></div>
<div class="MsoNormal">
<br /></div>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:8.0pt;
mso-para-margin-left:0in;
line-height:107%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-59467413598358974462015-04-14T04:14:00.001-07:002015-04-14T04:14:15.477-07:00The ESC key problem when you putty a linux machine<br />
You are under vi or vim and, after some edit of the file, try to exit. ESC key doesn't work. <br />
Instead of ESC, press ctrl+[<br />
<br />
That's all. Enjoy!Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0tag:blogger.com,1999:blog-6241917023015584345.post-29320263763492035932015-04-14T04:00:00.004-07:002015-04-14T04:00:21.671-07:00How to change vnc server password<span style="font-family: "Trebuchet MS",sans-serif;">Shortly:</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;"><span style="font-family: "Courier New",Courier,monospace;">su - <i>name_of_the_user</i> </span> </span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">(vnc server has different settings for different users)</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">vncpasswd</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">sudo service vncserver restart</span><br />
<span style="font-family: "Trebuchet MS",sans-serif;"><br /></span>
<span style="font-family: "Trebuchet MS",sans-serif;">or </span><br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">su -</span><br />
<span style="font-family: "Courier New",Courier,monospace;">service vncserver restart</span>Florin Videahttp://www.blogger.com/profile/09345726450177247251noreply@blogger.com0