mageed_ahmed بتاريخ: 22 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 22 مايو 2010 السلام عليكم ورحمة الله وبركاته يسعدني أن أقدم لكم هذه السلسلة المتجددة علي شكل سؤال وجواب في ادارة قواعد البيانات بهدف وضع حلول لبعض الاسئلة الشائعة في ادارة قواعد البيانات للمنفعة العامةأسأل الله لي ولكم التوفيق انه علي كل شئ قديرتنبيه هام:الموضوع قد يكون به بعض الاجابات المتطورة والتي تكون موجهه لمدراء قواعد البيانات المتمرسين لذلك علي السادة المبتدئين عدم استخدام أيا من الأكواد الواردة في الموضوع علي قواعد بيانات عاملة لأنه بعض الاكواد تشتمل علي تعليمات قد تؤدي الي ايقاف قاعدة البيانات ما لم يتم استخدامها لظرفها المناسب وادارة المنتدي تخلي مسؤليتها عن أي سوء استخدام للاكواد أو أي أضرار ناجمة لذا ننصح بالعمل علي بيئة تجريبيةقبل تنفيذها علي أي قواعد بيانات عاملة والله الموفقلنبدء----------------------السؤال كيف يمكنني مشاهدة database character setالاجابة : select * from nls_database_parameters لمعرفة قيمة NLS_lang لقاعدة البيانات ممن خلال props$ select value$ from props$ where name like '%NLS_CHARACTERSET%'عن PROPS$Content of base table SYS.PROPS$A long long time ago (during my Oracle 7 days), I once needed to update base table SYS.PROPS$. This action was needed to change the database NLS characterset of US7ASCII to a characterset that would support GERMAN. Based on a metalink note, updating the SYS.PROPS$ base table, was the only way to achieve this (or completely rebuild the environment) in those Oracle 7 days.This procedure was tricky. If you updated it with the wrong, an unsupported character set or with a typo in the string, the database would be corrupted and could not be started up again (so be warned if you want to fiddle around with the method)Since those days, I always lookup NLS settings via a quick select on that table. The last time I did this, was a long time ago and to my surprise, while looking up settings, I noticed that this table does contain more data then only NLS parameters these days…Output of a full (demo) clean database Oracle 11g installation gives:SQL> SELECT * FROM sys.props$;ملتقانا في السؤال القادم جوابه دمتم بخير 1 اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 22 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 22 مايو 2010 سؤال : ما هي ال VIEWS التي من خلالها يمكنني معرفة اصدار قاعدة البيانات وكذا معلومات اضافية جواب : يمكنك استخدام sys.v_$option و sys.v_$version 1 اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 22 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 22 مايو 2010 سؤال كثيرا ما يسألني اياه السادة الزملاء ماهي الخطوات التي يمكن اجراؤها لزيادة حماية قواعد البيانات What are three things we can do to quickly and easily to increase the security posture of our Oracle databases?وهو زيادة ايضاح علي الموضوع الذي رد عليه أخي الباشا فاليسمح لي سعادته باكمال الرد الموضوع http://www.araboug.org/ib/index.php?showtopic=40819&pid=187607&start=&st=#entry187607الاجابةأولا : حماية listener و sqlnet.oraMake sure the listener is password protected (this can be done via the lsnrctl utility or through the Netmanager GUI) and logging is enabled. Prevent people from modifying the listener remotely by adding the ADMIN_RESTRICTIONS_ = ON string to your listener.ora file. This is the default behavior in Oracle 10g and above unless you have disabled Local OS authentication by adding LOCAL_OS_AUTHENTICATION_ = OFF to your listener.ora file.ولتأكيد عدم السماح بالحول باستخدان OS Othentication يمكن تعديل sqlnet.ora كما يلي names.directory_path = (TNSNAMES)Be aware that securing the listener in 11g deviates from this advice! In 11g, the default listener can only be administered locally. Furthermore, the listener utilizes the local OS authentication to determine which user started the listener, and only allows that user (and super users) to administer the listener. However, setting a password for the 11g listener will ALLOW remote administration! For the Oracle 11g listener, you will actually reduce the database's network security posture by enabling a listener password. It is counter-intuitive, but this is a huge security improvement for the listener. There are many actions you can take to further harden your listener from attack, but these can be quickly and easily implemented on most systems with no adverse effects. ثانيا : تأكد أن OS permissions معمولة بالشكل السليمAccess should be appropriately, and strictly controlled to all the Oracle binaries, system files, archived redo logs and backups. Archived redo logs can easily be mined to divulge data that has been entered into your database using the Oracle LOGMNR utility, and cold backups or raw datafiles can be effectively read using a simple hex editor. ثالثا وأخيرا : لا تجعل خادم قواعد البيانات سهل المنال لأحد غير المصرح لهم (مدراء قواعد البيانات)If an attacker can gain physical access to your system, they can get to your data. Even Full Disk Encryption (FDE) can be defeated if someone gains access to the hardware. Depending on the size of your business, this may be as simple as changing out a few doorknobs. For a large organization, this is not a quick and easy endeavor – it requires considerable planning and implementation. However, it requires very little Oracle expertise to significantly mitigate this critical risk.لا تنسي كما ذكر الاخوة في ردودهم تغغير كلمة السر ل sys بعد ذلكموضوع اخر للايضاح والتوسع http://www.orafaq.com/node/567 تحياتي اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 22 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 22 مايو 2010 سؤال : كيف يمكنني استخدام كلمة السر في 11g لزيادة حماية قاعدة البياناتالاجابة : أمران الاول : تشغيل حالة الحروف : In Oracle 11g, you can enable or disable password case sensitivity. To control the use of case sensitivity in passwords, set the SEC_CASE_SENSITIVE_LOGON initialization parameter. Only users who have the ALTER SYSTEM privilege can set the SEC_CASE_SENSITIVE_LOGON parameter. Set it to TRUE to enable case sensitivity or FALSE to disable case sensitivity.The statement below enable case sensitivity.ALTER SYSTEM SET SEC_CASE_SENSITIVE_LOGON = TRUEالثاني : تعقيد كلمة السر قدر الاستطاعةrovide reasonable protection against intruders who try to break into the system by guessing passwords. Never use a dictionary based password. In Oracle11g, you can force users to create strong, secure passwords for database user accounts.Oracle provides a sample password verification function in the PL/SQL script called UTLPWDMG.SQL (located in $ORACLE_BASE/ORACLE_HOME/RDBMS/ADMIN).The UTLPWDMG.SQL script checks for the following requirements when users create or modify passwords: * The password contains at least eight characters and does not exceed 30 characters. * The password is not the same as the user name. * The password is not the same as the server name. * The password is not based on common dictionary based words.for example, welcome1, database1, account1, user1234, password1, oracle, oracle123, computer1, abcdefg1, or change_on_install. * The password includes at least 1 numeric and 1 alphabetic character. * The password differs from the previous password by at least 3 letters.تحياتي اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 سؤال : ماهي External Tables جواب : External tables are defined as tables that do not reside in the database, and can be in any format for which an access driver is provided. By providing Oracle with metadata describing an external table, Oracle is able to expose the data in the external table as if it were data residing in a regular database table. The external data can be queried directly and in parallel using SQL.The following is a listing of some of the limitations to external tables: * The metadata of external tables is created using the SQL CREATE TABLE ... ORGANIZATION EXTERNAL statement. * The actual data resides outside the database in OS files, hence the clause ORGANIZATION EXTERNAL organization. * The OS files are identified inside the database through a logical directory defining the OS physical directory where they are located. * The data is read only. * You cannot perform any DML operations (INSERT, UPDATE, or DELETE), nor create indexes on external tables. * You can, although, create views and synonyms for external tables. * The external table can be queried and joined directly, in parallel using the SQL statement SELECT. * The ANALYZE statement is not supported for gathering statistics for external tables. The DBMS_STATS package, although, can be used for gathering statistics for external tables. اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 سؤال : كيف يمكنني عمل drop لعمود من جدول في الاصدارات Oracle 8i and higher؟؟جواب : نفرض أن لدينا جدول CREATE TABLE d_table ( id_no NUMBER , name VARCHAR2(100) , d_column VARCHAR2(100) ) /طريقتان1-عمل العمود غير مستخدم ثم ازالته ALTER TABLE d_table SET UNUSED COLUMN d_column;SELECT * FROM sys.dba_unused_col_tabs;ALTER TABLE d_table DROP UNUSED COLUMNS;ولي نصيحة هنا Marking a column as unused and then using the alter table name drop unused column statement is useful because it allows the DBA to take away column access quickly and immediately. Later on, during a routine database maintenance weekend or after business hours, you can then remove the column with the alter table name drop unused column to reclaim the space. 2-Physically Removing the ColumnALTER TABLE d_table DROP COLUMN d_column CASCADE CONSTRAINTS;والطريقة هذه فيها optional clauses وهي * cascade constraints - Any foreign keys referring to the column to be dropped, or any constraints on the column itself, will be eliminated along with the column. * invalidate - Any objects related to the table whose column is being dropped will be marked INVALID. * checkpoint num - Allows the DBA to reduce the amount of space used in a rollback segment by having Oracle perform a checkpoint every num number of rows. For the duration of the alter table drop column operation, the table will show a status of INVALID. If the operation terminates abnormally, Oracle will be able to rollback only to the most recent checkpoint and the table would remain in an INVALID state. However, you can resume the removal of the column after instance recovery is made or when you reconnect using the alter table name drop columns continue statement. اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 سؤال : معلوم أنه يتم عمل index علي PK لكن هل يمكن عمله علي FKالجواب : نعم يمكن وله فوائد دعنا نبدأمعروف أن عمل FK يزيد من integrity او استقامة وسلامة البيانات من اضافة بيانات في ال detail tables وليس لها ساس في ال parent tables سأقوم بعمل جدولين "EMP" and "DEPT" كل منهما فيه PK وفي جدول EMP يوجد FK وهو deptno وال PK له هو dept.deptno CREATE TABLE dept ( deptno NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY , dname VARCHAR2(14) , loc VARCHAR2(13) ); CREATE TABLE emp ( empno NUMBER(4) CONSTRAINT PK_EMP PRIMARY KEY , ename VARCHAR2(10) , job VARCHAR2(9) , mgr NUMBER(4) , hiredate DATE , sal NUMBER(7,2) , comm NUMBER(7,2) , deptno NUMBER(2) ); ALTER TABLE emp ADD CONSTRAINT emp_fk1 FOREIGN KEY (deptno) REFERENCES dept (deptno);code/]]بمجرد تفعيل ال CONSTRAINT emp_fk1وبحاوله اضافة صف في emp وبه deptno غير موجود بالجدول الاب dept سيحدث خطأ في الادخال لعدم توافق fk مع pk عموما لتجنب ال integrity الحاصل نحتاج لعمل ما يعرف ب full "table-level" lock علي ال child table حينما يتم التعديل في ال parent tableالحل :نقوم بعمل index علي foreign key of the child tableCREATE INDEX emp_n1 ON emp(deptno) TABLESPACE indx;أحيانا نقوم بعمل ال index on the foreign key لتحسين ال join and queries وهنا تكمن الفائدة فان لم تستطع عمل foreign key index وفي حال تحديث قيمة ال PK في ال parent table ستواجه locks كتيرة وبالتالي يحستحسن عمل index علي fkالموضوع هام في performance tuning تحياتي اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 س Who Am Iج :سكريبت لمعرفة معلومات عن قاعدة بياناتك select 'User: '|| user || ' on database ' || global_name, ' (term='||USERENV('TERMINAL')|| ', audsid='||USERENV('SESSIONID')||')' as MYCONTEXT from global_name; اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ENG_HOSSAM_WALLY بتاريخ: 23 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 مجهود طيب منك يابشمهندس ربنا يبارك فيك ويجعله فى ميزان حسناتك اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 يشرفني وجودك ها هنا مهندس حسام س : كيف يمكنني معرفة المستخدمين ومنذ كم من الوقت ؟ج : select USERNAME,OSUSER ,TERMINAL ,SYSDATE-logon_time "Days", (SYSDATE-logon_time)*24 "Hours" from sys.v_$session; 2 اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 س : كمدير لقواعد البيانات كيف يمكنني تسجيل كل رسائل الخطأ التي تواجه المستخدمين في جدول ؟ج : باتباع ما يلي create table log_errors_tab ( error varchar2(30), timestamp date, username varchar2(30), osuser varchar2(30), machine varchar2(64), process varchar2(8), program varchar2(48)); create or replace trigger log_errors_trig after servererror on database declare var_user varchar2(30); var_osuser varchar2(30); var_machine varchar2(64); var_process varchar2(8); var_program varchar2(48); begin select username, osuser, machine, process, program into var_user, var_osuser, var_machine, var_process, var_program from sys.v_$session where audsid = userenv('sessionid'); insert into log_errors_tab values(dbms_standard.server_error(1),sysdate,var_user, var_osuser,var_machine,var_process,var_program); end; / 2 اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Amgad بتاريخ: 23 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 السلام عليكم ورحمة الله اعتذر عن مقاطعة سلسلة السؤال والجواب ولكن السبب هو : توجيه الشكر والتحية والتقدير الى مشرفنا القدير ... المهندس / احمد جزاك الله خيراوبارك الله فيك اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 الشكر موصول لكم استاذي المهندس امجد س : كيف يمكن لمدير قواعد البيانات معرفة ما اذا كان هناك deafult passwords ج : يمكن استخدام السكريبت التالي مع تطويره SELECT username "User(s) with Default Password!" , account_status "Account Status" FROM dba_users WHERE password IN ( 'E066D214D5421CCC' -- dbsnmp , '24ABAB8B06281B4C' -- ctxsys , '72979A94BAD2AF80' -- mdsys , 'C252E8FA117AF049' -- odm , 'A7A32CD03D3CE8D5' -- odm_mtr , '88A2B2C183431F00' -- ordplugins , '7EFA02EC7EA6B86F' -- ordsys , '4A3BA55E08595C81' -- outln , 'F894844C34402B67' -- scott , '3F9FBD883D787341' -- wk_proxy , '79DF7A1BD138CF11' -- wk_sys , '7C9BA362F8314299' -- wmsys , '88D8364765FCE6AF' -- xdb , 'F9DA8977092B7B81' -- tracesvr , '9300C0977D7DC75E' -- oas_public , 'A97282CE3D94E29E' -- websys , 'AC9700FD3F1410EB' -- lbacsys , 'E7B5D92911C831E1' -- rman , 'AC98877DE1297365' -- perfstat , 'D4C5016086B2DC6A' -- sys , 'D4DF7931AB130E37') -- system / اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 23 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 23 مايو 2010 س : كيف يمكنني تشفير كلمة السر بدلا من كونها صريحة ج : الجواب هنا اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Dr.TIGer بتاريخ: 24 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 24 مايو 2010 السلام عليكم جزاك الله الجنة استاذي القدير لدي سؤال انا انشأت الtable وال Triggerولما استعلمت بعد دقيقة ويظهر لي التالي ERROR TIMESTAMP USERNAME OSUSER ----------------------------------------------------------------- --------- ------------------------------ ----------------------------25228 24-MAY-10 DBSNMP NT AUTHORITY\SYSTEM ومتكرر اكثر من 70 مرة ارجو توضحيح لي ما السبب لأنني مبتدأ جدا في DBA س : كمدير لقواعد البيانات كيف يمكنني تسجيل كل رسائل الخطأ التي تواجه المستخدمين في جدول ؟ج : باتباع ما يلي create table log_errors_tab ( error varchar2(30), timestamp date, username varchar2(30), osuser varchar2(30), machine varchar2(64), process varchar2(8), program varchar2(48)); create or replace trigger log_errors_trig after servererror on database declare var_user varchar2(30); var_osuser varchar2(30); var_machine varchar2(64); var_process varchar2(8); var_program varchar2(48); begin select username, osuser, machine, process, program into var_user, var_osuser, var_machine, var_process, var_program from sys.v_$session where audsid = userenv('sessionid'); insert into log_errors_tab values(dbms_standard.server_error(1),sysdate,var_user, var_osuser,var_machine,var_process,var_program); end; / اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 24 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 24 مايو 2010 وعليكم السلام طالما نجحت في تخزين رسائل الخطأ فما نحن بصدده قد تم ونحجت فيه أنت بحمد الله في الرد القادم سأوضح لك الرسالة ان امكنني الله تحياتي اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
honr بتاريخ: 24 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 24 مايو 2010 جزاك الله خيراً على الجهد الذي تبذله في خدمة المسلمين لدي سؤال حيث أنني مبتدأ في الأوراكل الآن نزلت قاعدة البيانات على السيرفر ومن حهاز الكلاينت ( العميل ) نزلت برنامج Toad لكن لا أعرف كيف أتصل بقاعدة البيانات الموجودة بالسيرفر أنتظر الإجابة منك اخي أحمد كما عهدناك سباقاً في خدمة المسلمين اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 24 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 24 مايو 2010 العفو أستاذيtoad لا يحتاج لتهيئة 1-تأكد أولا أن قاعدة البيانات تعمل جيدا من خلال محرك SQL الخاص بها 2-في TOad تجد Connect Using اختر الhome الخاصة ب database which is by default like this name "Oradb_10g_home1"وفي الاعلي اختر database لتكون orcl مثلا اكتب اسم المستخدم وكلمة السر مستخدما normal كل هذا بشرط أن تكون قاعدة البيانات مفتوحة وتجرب المستخدم بكلمة سرة ب sql وان وجدت صعوبة عاود ومعك ان احيانا الله 1 اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
ENG_HOSSAM_WALLY بتاريخ: 24 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 24 مايو 2010 بارك الله فيك يابشمهندسوالله انه لجهد وفير وعمل جاد ودؤب .. أسأل الله ان ينفع به المسلمينوان يجعله فى ميزان حسناتك اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mostfa_future بتاريخ: 25 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 25 مايو 2010 بارك الله فيك ياخى و نتظر المزيد اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 25 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 25 مايو 2010 س : هل يمكن عمل enable أو disable لكل triggers بتعليمة واحدة في schema معينة ج : نعم واليك الكودهام : علي المبتدئين والزملاء الجدد عدم تجربة أيا من الاكواد هذه ان لم تكن تدرك ما ستفعله قد يؤدي ذلك الي تلف قاعدة البيانات بالكامل ونخلي مسؤليتنا عن أي أضرار قد تنجم بسبب عدم دراية الاستخدام CREATE or replace procedure enable_triggers as v_tablename varchar2(100); v_query1 varchar2(100); v_query2 varchar2(100); v_query varchar2(100); -- A cursor is used to fetch all the Tables in the Schema cursor v_cursor is select table_name from User_tables; v_row v_cursor%rowtype; begin open v_cursor; loop fetch v_cursor into v_row; if v_cursor%notfound then exit; end if; v_tablename := v_row.table_name; v_query1:=\'alter table\'; -- For disabling the triggers on the tables , -- the following line can be changed as \" v_query2:=\'disable all triggers\';\" v_query2:=\'enable all triggers\'; v_query:=v_query1||\' \'||v_tablename||\' \'||v_query2; dbms_output.put_line(v_query); execute immediate ( v_query); end loop; close v_cursor; end; / --- Execute the Procedure ------ EXECUTE ENABLE_TRIGGERS; لاحظ لعمل disable قم بالتغيير الي 'disable all triggersحسب التعليمات داخل الكود اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 25 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 25 مايو 2010 س : أريد script أستطيع من خلالها تحويل استخراج بيانات جدول معين علي شكل comma delimited formatمعذرة : ماهل ال comma delimited format اصلا يعني لو عندي جدول فيه الاسم والعمر الفورمات محتاجه علي هذا الشكل \"ahmed\", \"20\"طيب وما الغرض الغرض هو تعليمنا كيف يمكننا استخراج البيانات من جدول علي شكل معين وعمل ال script أوتوماتيك في ملف مع تغيير ما يلزم طيب وما الفائدة لثاني مرةالاجابة : ربما تحب أن تستخرج بيانات جدول لتستخدمه في نظام اخر مثل رواتب البنوك يحتاجوا البيانات علي شكل مثلا الاسم - الكود - اراتب / عدد الايام وهكذالو كنا نستخدم SQL في اجراء التعليمة القادمة سنجد ملف في نفس المسار الموجود فيه SQL يعني بعد الانتهاء مسار ال sql مثلا هوC:\oracle\BIN سنجد الملف اسمه tbdump.sql في نفس المسار الخطوات 1- نفذ set pagesize 0 set trimspool on set serverout on clear buffer undef dumpfile undef dumptable undef dumpowner var maxcol number var linelen number var dumpfile char(40) col column_id noprint set pages 0 feed off termout on echo off verify off accept dumpowner char prompt 'Owner of table to dump: ' accept dumptable char prompt 'Table to dump: ' begin select max (column_id) into :maxcol from all_tab_columns where table_name = rtrim (upper ('&dumptable')) and owner = rtrim (upper ('&dumpowner')); select sum (data_length) + (:maxcol * 3) into :linelen from all_tab_columns where table_name = rtrim (upper ('&dumptable')) and owner = rtrim (upper ('&dumpowner')); end; / print linelen print maxcol spool tbdump.sql select 'set trimspool on' from dual; select 'set termout off pages 0 heading off echo off' from dual; select 'set line '||:linelen from dual; select 'spool '||lower ('&dumptable')||'.txt' from dual; select 'select'||chr (10) from dual; select ' '||''''||'"'||''''||'||'|| 'replace ('||column_name||', '||''''||'"'||''''||') '|| ' ||'||''''||'", '||''''||' || ', column_id from all_tab_columns where table_name = upper ('&dumptable') and owner = upper ('&dumpowner') and column_id < :maxcol union select ' '||''''||'"'||''''||'||'|| 'replace ('||column_name||', '||''''||'"'||''''||') '|| ' ||'||''''||'"'||'''', column_id from all_tab_columns where table_name = upper ('&dumptable') and owner = upper ('&dumpowner') and column_id = :maxcol order by 2; select 'from &dumpowner..&dumptable;' from dual; select 'spool off' from dual; spool off ; سيسألك عن ما هو ال table owner يعني schema or userOwner of table to dump: مثلا scottثم اسم الجدول test Table to dump: ستجد ان الناتج شيئان الكود الذي ستجريه ليخرج لك الناتج تجريه بيدك أو الملف المسمي tbdump.sql يمكنك تشغيل هذه السكريبت كما يلي SQL> @tbdump.sql اذهب الي المسار الذي فيه sql سنجد ملف نصي باسم الجدول test.txt هامكان يكفيني وضع السكريبت حيث أن معظمنا يعرف الشرح الذي أكتبه لكن هو لافادة الاخوة الجدد تحياتي اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 25 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 25 مايو 2010 س : لمستخدم معين داخل قاعدة البيانات هل يمكن عمل script لمعرفة كل ما يخص schemas من معلوماتممكن توضح أكثر؟ممكن أريد معرفة اصدار الاوراكل واصدار PL والمستخدمين وكذلك لكل مستخدم ما هو PROFILE DEFAULT_TABLESPACE TEMPORARY_TABLESPACEوكذلك ال Tablespace Informationحسنا استخدم التالي set feedback off set termout on set pagesize 56 set linesize 800 ttitle off spool D:\userinfo.wri set verify off set heading on Prompt Database Name: select 'Database Name (SID): ' || name "name" from v$database; prompt prompt prompt Database Version Informations: select * from v$version; select username,profile,default_tablespace,temporary_tablespace from dba_users; Prompt Database Character Set Informations: select * from nls_database_parameters; Prompt Database Segment Managment Informations: select TABLESPACE_NAME,BLOCK_SIZE,EXTENT_MANAGEMENT,SEGMENT_SPACE_MANAGEMENT from dba_tablespaces; Prompt Database Object Informations: select owner,object_type,count(1) from dba_objects Where owner not IN ('SYS','MDSYS','CTXSYS','HR','ORDSYS','OE','ODM_MTR','WMSYS','XDB','QS_WS', 'RMAN','SCOTT','QS_ADM','QS_CBADM', 'ORDSYS','OUTLN','PM','QS_OS','QS_ES','ODM','OLAPSYS','WKSYS','SH','SYSTEM','ORDPLUGINS','QS','QS_CS') group by owner,object_type order by owner; Prompt File and Tablespace Informations: SELECT file_name,tablespace_name,autoextensible,maxbytes/1048576 FROM dba_data_files; spool off مرفق أيضا userinfo.txt اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Dr.TIGer بتاريخ: 26 مايو 2010 تقديم بلاغ مشاركة بتاريخ: 26 مايو 2010 السلام عليكم جزاك الله الجنة استاذي القديرلدي سؤال انا انشأت الtable وال Triggerولما استعلمت بعد دقيقة ويظهر لي التاليERROR TIMESTAMP USERNAME OSUSER----------------------------------------------------------------- --------- ------------------------------ ----------------------------25228 24-MAY-10 DBSNMP NT AUTHORITY\SYSTEMومتكرر اكثر من 70 مرةارجو توضحيح لي ما السببلأنني مبتدأ جدا في DBAعرض مشاركةmageed_ahmed في 23 May 2010 - 05:36 PM كتب :س : كمدير لقواعد البيانات كيف يمكنني تسجيل كل رسائل الخطأ التي تواجه المستخدمين في جدول ؟ج : باتباع ما يليcreate table log_errors_tab ( error varchar2(30), timestamp date, username varchar2(30), osuser varchar2(30), machine varchar2(64), process varchar2(8), program varchar2(48));create or replace trigger log_errors_trig after servererror on databasedeclare var_user varchar2(30); var_osuser varchar2(30); var_machine varchar2(64); var_process varchar2(8); var_program varchar2(48);begin select username, osuser, machine, process, program into var_user, var_osuser, var_machine, var_process, var_program from sys.v_$session where audsid = userenv('sessionid'); insert into log_errors_tab values(dbms_standard.server_error(1),sysdate,var_user, var_osuser,var_machine,var_process,var_program);end;/ اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
mageed_ahmed بتاريخ: 26 مايو 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 26 مايو 2010 ERROR TIMESTAMP USERNAME OSUSER----------------------------------------------------------------- --------- ------------------------------ ----------------------------25228 24-MAY-10 DBSNMP NT AUTHORITY\SYSTEM/ أخي الكريم هذا يعني كما ذكرت لك أنه يعمل الخطأ الموجود هو كوده 25228 لذا قم بالبحث عن سبب وجود الخطأ Ora-25228 لانه كل يوم يمكن أن يأتيك برسالة جديدة كما يرجي العلم بأن هناك رسائل كثيرة يمكن تجاهلها وعموما شرح الرساله هو ORA-25228: timeout or end-of-fetch during message dequeue from string.stringCause: User-specified dequeue wait time has passed or the end of the queue has been reached but no message has been retrieved.Action: Try dequeue again with the appropriate WAIT_TIME or the FIRST_MESSAGE option.You have your WAIT_TIME set to NO_WAIT and your script does not show any messages being enqueued, nor do you mention that, so your script and Oracle are executing as designed. In other words, no message to dequeue exist and the code is not supposed to wait around so it throws the valid error immediately upon attempting the dequeue from the empty queue.I have no clue what your true goal is but also consider PL/SQL callback notification when registering a subscriber. AQ will trigger the registered PL/SQL code when a message is enqueued.تحياتي اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Recommended Posts
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.